getconfig icon indicating copy to clipboard operation
getconfig copied to clipboard

Local is overwriting NODE_ENV

Open molinto opened this issue 6 years ago • 3 comments

I have these env as json files in my config/ dir:

  • default
  • dev
  • local
  • production
  • staging

Although I have NODE_ENV set to 'staging', the config 'local' seems to be included to & overwrites the values.

v: 3.1.0

molinto avatar Dec 18 '18 12:12 molinto

Same on v4.5.0 too

molinto avatar Dec 18 '18 12:12 molinto

Renaming in to localbox.json works

molinto avatar Dec 18 '18 12:12 molinto

this is intended behavior, see: https://github.com/HenrikJoreteg/getconfig#where-to-put-your-config-and-what-to-call-it

specifically the list of what configuration files are attempted and the order they're attempted in. each of those files is attempted and layered on top of the previous config layer.

that said, i do think that the local concept is kind of moot right now given the .env file support, so i'll likely remove that special case soon.

nlf avatar Dec 18 '18 19:12 nlf