dotenv-rails 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +12 -3
- data/lib/dotenv/rails.rb +1 -1
- metadata +20 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 30cce7ec7dfd3836028bedc646424eab5a14cc85
|
|
4
|
+
data.tar.gz: 6a018af13b56cc242033495eb3ebe1b14c43c69b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e30b502fa351c26da24d87500f1c05b2eb0506c50bbb3f4d4b4e45dadf645afb515cc75fc30f4078d84e51fba01864cb47385b713b9db34d7d24e43abda5d46a
|
|
7
|
+
data.tar.gz: e795d812359bc167b896480dca63064b7be6c1664a32e6be65ab1e8858cd28a1426113e5587415918700d68acd9d0b6ba6bb0b46cca59b7160fbfd7dc9cebd61
|
data/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# dotenv [](https://travis-ci.org/bkeepers/dotenv)
|
|
2
2
|
|
|
3
|
+
[](https://gitter.im/bkeepers/dotenv?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
4
|
+
|
|
3
5
|
Shim to load environment variables from `.env` into `ENV` in *development*.
|
|
4
6
|
|
|
5
|
-
Storing [configuration in the environment](http://
|
|
7
|
+
Storing [configuration in the environment](http://12factor.net/config) is one of the tenets of a [twelve-factor app](http://12factor.net). Anything that is likely to change between deployment environments–such as resource handles for databases or credentials for external services–should be extracted from the code into environment variables.
|
|
6
8
|
|
|
7
9
|
But it is not always practical to set environment variables on development machines or continuous integration servers where multiple projects are run. dotenv loads variables from a `.env` file into `ENV` when the environment is bootstrapped.
|
|
8
10
|
|
|
@@ -88,6 +90,11 @@ If you need multiline variables, for example private keys, you can double quote
|
|
|
88
90
|
PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nHkVN9…\n-----END DSA PRIVATE KEY-----\n"
|
|
89
91
|
```
|
|
90
92
|
|
|
93
|
+
You need to add the output of a command in one of your variables? Simply add it with `$(your_command)`:
|
|
94
|
+
```shell
|
|
95
|
+
DATABASE_URL="postgres://$(whoami)@localhost/my_database"
|
|
96
|
+
```
|
|
97
|
+
|
|
91
98
|
You may also add `export` in front of each line so you can `source` the file in bash:
|
|
92
99
|
|
|
93
100
|
```shell
|
|
@@ -113,11 +120,13 @@ Variable names may not contain the `#` symbol. Values can use the `#` if they ar
|
|
|
113
120
|
|
|
114
121
|
## Multiple Rails Environments
|
|
115
122
|
|
|
116
|
-
dotenv was originally created to load configuration variables into `ENV` in *development*. There are typically better ways to manage configuration in production environments - such as `/etc/environment` managed by [Puppet](https://github.com/puppetlabs/puppet) or [Chef](https://github.com/
|
|
123
|
+
dotenv was originally created to load configuration variables into `ENV` in *development*. There are typically better ways to manage configuration in production environments - such as `/etc/environment` managed by [Puppet](https://github.com/puppetlabs/puppet) or [Chef](https://github.com/chef/chef), `heroku config`, etc.
|
|
117
124
|
|
|
118
125
|
However, some find dotenv to be a convenient way to configure Rails applications in staging and production environments, and you can do that by defining environment-specific files like `.env.production` or `.env.test`.
|
|
119
126
|
|
|
120
|
-
You can also `.env.local` for local overrides.
|
|
127
|
+
You can also use `.env.local` for local overrides.
|
|
128
|
+
|
|
129
|
+
If you use this gem to handle env vars for multiple Rails environments (development, test, production, etc.), please note that env vars that are general to all environments should be stored in `.env`. Then, environment specific env vars should be stored in `.env.<that environment's name>`. When you load a certain environment, dotenv will first load general env vars from `.env`, then load environment specific env vars from `.env.<current environment>`. Variables defined in `.env.<current environment>` will override any values set in `.env` or already defined in the environment.
|
|
121
130
|
|
|
122
131
|
## Should I commit my .env file?
|
|
123
132
|
|
data/lib/dotenv/rails.rb
CHANGED
|
@@ -4,7 +4,7 @@ Dotenv.instrumenter = ActiveSupport::Notifications
|
|
|
4
4
|
|
|
5
5
|
# Watch all loaded env files with Spring
|
|
6
6
|
begin
|
|
7
|
-
require "spring/
|
|
7
|
+
require "spring/commands"
|
|
8
8
|
ActiveSupport::Notifications.subscribe(/^dotenv/) do |*args|
|
|
9
9
|
event = ActiveSupport::Notifications::Event.new(*args)
|
|
10
10
|
Spring.watch event.payload[:env].filename if Rails.application
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dotenv-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brandon Keepers
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2016-03-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: dotenv
|
|
@@ -16,42 +16,48 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - '='
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 2.
|
|
19
|
+
version: 2.1.1
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - '='
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 2.
|
|
26
|
+
version: 2.1.1
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
28
|
+
name: railties
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
31
|
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0'
|
|
34
|
-
|
|
33
|
+
version: '4.0'
|
|
34
|
+
- - "<"
|
|
35
|
+
- !ruby/object:Gem::Version
|
|
36
|
+
version: '5.1'
|
|
37
|
+
type: :runtime
|
|
35
38
|
prerelease: false
|
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
40
|
requirements:
|
|
38
41
|
- - ">="
|
|
39
42
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0'
|
|
43
|
+
version: '4.0'
|
|
44
|
+
- - "<"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '5.1'
|
|
41
47
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
48
|
+
name: spring
|
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
|
44
50
|
requirements:
|
|
45
|
-
- - "
|
|
51
|
+
- - ">="
|
|
46
52
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
53
|
+
version: '0'
|
|
48
54
|
type: :development
|
|
49
55
|
prerelease: false
|
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
57
|
requirements:
|
|
52
|
-
- - "
|
|
58
|
+
- - ">="
|
|
53
59
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
60
|
+
version: '0'
|
|
55
61
|
description: Autoload dotenv in Rails.
|
|
56
62
|
email:
|
|
57
63
|
- brandon@opensoul.org
|
|
@@ -84,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
84
90
|
version: '0'
|
|
85
91
|
requirements: []
|
|
86
92
|
rubyforge_project:
|
|
87
|
-
rubygems_version: 2.
|
|
93
|
+
rubygems_version: 2.4.5.1
|
|
88
94
|
signing_key:
|
|
89
95
|
specification_version: 4
|
|
90
96
|
summary: Autoload dotenv in Rails.
|