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

Add NODE_CONFIG_RUNTIME process.env variable to completely overwrite all config data #611

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

suil
Copy link

@suil suil commented Jun 18, 2020

process.env.NODE_CONFIG_RUNTIME runtime variable can only overwrite on top of config data after being loaded from files.

We need a process.env variable that can completely bypass config files loading process. So that we could create json file in the build time and only upload compiled config data to servers.

Also with new process.env.NODE_CONFIG_RUNTIME variable, we could use webpack.DefinePlugin to ship bundled artifact without copy all files under config folder.

@suil
Copy link
Author

suil commented Jun 18, 2020

I found some tests are failing. After you agree on my approach, I will add tests and modify readme.

@markstos
Copy link
Collaborator

I'm not sure I agree this is needed. If your build system is already modifying things, why not just delete the config files that you don't want to ship to production?

I do that for a project and it's easy enough. For example, for a server in Canada, I don't ship the configs that only apply to customers in the United States.

@markstos
Copy link
Collaborator

process.env.NODE_CONFIG_RUNTIME runtime variable can only overwrite on top of config data after being loaded from files.

Do you actually intend to refer to RUNTIME_JSON_FILENAME here?

This is a challenge with this feature proposal-- there's already an environment variables with a similar name that does a slightly different thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants