Hello !
From the doc, there is a way to set environment variables using the config.env
key. However, I see one problem here :
Environment variables should not be committed to version control (Git / SVN...). They can be different between environment (local development, continuous integration, production...), and placing them inside the whole project configuration makes it difficult / impossible to maintain. I would have to remember before each commit to remove the environment variables. 😅
What I'm suggesting is following practices already in place : .env
files.
Environment variables should be defined in here, not in the configuration file anymore. That way, this file could be omitted from version control, and everything would be separated between environments. Of course, the developer would have to think to create the .env
file on every machine he uses, but that's a small trade-off in my opinion.
What do you think ? Did you already though about it and decided not to implement it ?
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c513">#c513</a>)</em></sub></div>