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

Fix issue #6 - Change priority of keys to env then file #11

Merged
merged 2 commits into from Sep 10, 2014

Conversation

@jbuck
Copy link
Collaborator

@jbuck jbuck commented Jun 2, 2014

No description provided.

@jbuck
Copy link
Collaborator Author

@jbuck jbuck commented Jun 2, 2014

@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');

This comment has been minimized.

@humphd

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)?

This comment has been minimized.

@brianloveswords

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.

@@ -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:

This comment has been minimized.

@sedge

sedge Jun 3, 2014

"...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
@brianloveswords brianloveswords merged commit 519de62 into brianloveswords:master Sep 10, 2014
1 check was pending
1 check was pending
@brianloveswords
continuous-integration/travis-ci The Travis CI build is in progress
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants