Skip to content

Use custom runtime environmental variables (instead of NUXT_ prefix) #23714

@vgouv

Description

@vgouv

Describe the feature

Refering to runtime configuration , I think that the current implementation (runtime variables will be overriden by NUXT_ prefixed environmental viariables) is kind of ugly.
The problem is that one may already have some env vars, e.g. (DB_URL), that might live in a common env file that is shared among many applications. With the current implementation we have to "pollute" the env file with duplicate definitions (e.g. add the NUXT_DB_URL in addition to the already existing, duplicating the variable content as well).

While, nuxt could just have a semantic to resolve arbitrary env vars (at runtime). e.g.

export default defineNuxtConfig({
  runtimeConfig: {
    apiSecret: '${APP_SECRET}' // This resolves the environment variable APP_SECRET at runtime

Using

nuxt version 3.6.5

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions