envkey / envkey-node

EnvKey's official Node.js client library
https://www.envkey.com
MIT License
49 stars 9 forks source link

Can we override variables in a .env.test file? #19

Closed shamoons closed 5 years ago

shamoons commented 5 years ago

I know anything in .env will override. But what about .env.test?

danenania commented 5 years ago

Yes, with custom loading you can specify a different path:

import {load as envkeyLoad} from 'envkey/loader'

envkeyLoad({ dotEnvFile: ".staging.env" })
shamoons commented 5 years ago

Then do I need to have a .env.test file? Or will it also work from actual environment variables @danenania ?

danenania commented 5 years ago

envkey will defer to anything in the .env file (which could be .env.test or whatever path you set) or any environment variables that are already set. So either would work to override.