Fix issue #6 - Change priority of keys to env then file #11
Conversation
|
@brianloveswords I think we should release a patch version that includes the fixes I did previously, then merge this in and release it was v2.0 since it's a breaking change |
| Try to load a set of environment variables from a file. This **will not** override whatever is in the environment. This is a change from Habitat v1.x's behaviour. This means that you can chain multiple environment files together to provides sane defaults for your local development or to commit environment configuration into your repository: | ||
|
|
||
| ```js | ||
| habitat.load('.env'); |
humphd
Jun 2, 2014
What if load can take a String (1.x behaviour, single file) or an Array of String (2.x behaviour, with overrides happening based on ordering)?
What if load can take a String (1.x behaviour, single file) or an Array of String (2.x behaviour, with overrides happening based on ordering)?
brianloveswords
Jun 3, 2014
Owner
I think my preference would be this to take a second, optional argument object which can determine whether the behavior is to fill-in or override.
// Precedence:
// system environment
// config/production.env
// config/default.env
habitat.load([
"config/production.env",
"config/default.env"
], { override: false });
// Precedence:
// config/production.env
// config/default.env
// system environment
habitat.load([
"config/default.env"
"config/production.env",
], { override: true });
Depending on whether the default for override is true or false would determine whether we have to bump the major version.
I think my preference would be this to take a second, optional argument object which can determine whether the behavior is to fill-in or override.
// Precedence:
// system environment
// config/production.env
// config/default.env
habitat.load([
"config/production.env",
"config/default.env"
], { override: false });// Precedence:
// config/production.env
// config/default.env
// system environment
habitat.load([
"config/default.env"
"config/production.env",
], { override: true });Depending on whether the default for override is true or false would determine whether we have to bump the major version.
| @@ -108,7 +108,13 @@ var nodeEnv = habitat.get('nodeEnv'); | |||
| ``` | |||
|
|
|||
| ## habitat.load([*pathToEnvFile*]) | |||
| Try to load a set of environment variables from a file. This **will** override whatever is in the environment. | |||
| Try to load a set of environment variables from a file. This **will not** override whatever is in the environment. This is a change from Habitat v1.x's behaviour. This means that you can chain multiple environment files together to provides sane defaults for your local development or to commit environment configuration into your repository: | |||
sedge
Jun 3, 2014
"...to provides sane defaults..." -> "...to provide..."
"...to provides sane defaults..." -> "...to provide..."
brianloveswords
added a commit
that referenced
this pull request
Sep 10, 2014
Fix issue #6 - Change priority of keys to env then file
519de62
into
brianloveswords:master
1 check was pending
1 check was pending
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
No description provided.