Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supports reading configuration from environment variables at runtime #2991

Open
1 task
medz opened this issue Jan 13, 2025 · 0 comments
Open
1 task

Supports reading configuration from environment variables at runtime #2991

medz opened this issue Jan 13, 2025 · 0 comments

Comments

@medz
Copy link

medz commented Jan 13, 2025

Describe the feature

I noticed that the configuration of nitro's nitro.config.ts will eventually be serialized and read as JSON.

This creates the following problems:

  1. When using Docker for image packaging, sensitive information must be configured in the code (such as database account passwords and some cloud service keys, etc.)

  2. It is not possible to distinguish the configuration well for dev/test/prod, etc.

Expected goals

For example, when configuring the value of nitro.config.ts, we are allowed to configure environment variables, which will not be serialized and will only be read from the environment variables when the app starts.

Simple example:

export default defineNitroConfig({
  compatibilityDate: "2025-01-11",
  storage: {
    cache: {
      driver: "redis",
      host: process.env.REDIS_HOST, // or env("REDIS_HOST")
      port: 6379,
    },
  },

Additional information

  • Would you be willing to help implement this feature?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant