dotenv-rails 2.7.2 → 2.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -0
- data/lib/dotenv/rails.rb +5 -4
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 289d5d8c735671954ed6e3d2a28d1e5aba13ebd596bc70e2ef017bfdbf616fbb
|
4
|
+
data.tar.gz: 587829b2b4d7a875ba6d29385e2972bf978900b63e735b30bd99923b713623a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4abb9a25a8cc45f37f0364ceabf185fbc473625ef6383009361c0b2c4dcce40212ffa928c71b276439a290b3a0a90355bdae09ccbd5384c4c8f487eb01199012
|
7
|
+
data.tar.gz: 2cb4873b366bea396ecd37f48d79e925bedc18e1d6d2b0c5e21153a86c0dae9c1beb817e6aa7203df75ef1efc64ed931a2d0a65522036fd594692a51282c5651
|
data/README.md
CHANGED
@@ -218,6 +218,29 @@ If you use this gem to handle env vars for multiple Rails environments (developm
|
|
218
218
|
|
219
219
|
Credentials should only be accessible on the machines that need access to them. Never commit sensitive information to a repository that is not needed by every development machine and server.
|
220
220
|
|
221
|
+
|
222
|
+
You can use the `-t` or `--template` flag on the dotenv cli to create a template of your `.env` file.
|
223
|
+
```shell
|
224
|
+
$ dotenv -t .env
|
225
|
+
```
|
226
|
+
A template will be created in your working directory named `{FINAME}.template`. So in the above example, it would create a `.env.template` file.
|
227
|
+
|
228
|
+
The template will contain all the environment variables in your `.env` file but with their values set to the variable names.
|
229
|
+
|
230
|
+
```shell
|
231
|
+
# .env
|
232
|
+
S3_BUCKET=YOURS3BUCKET
|
233
|
+
SECRET_KEY=YOURSECRETKEYGOESHERE
|
234
|
+
```
|
235
|
+
|
236
|
+
Would become
|
237
|
+
|
238
|
+
```shell
|
239
|
+
# .env.template
|
240
|
+
S3_BUCKET=S3_BUCKET
|
241
|
+
SECRET_KEY=SECRET_KEY
|
242
|
+
```
|
243
|
+
|
221
244
|
Personally, I prefer to commit the `.env` file with development-only settings. This makes it easy for other developers to get started on the project without compromising credentials for other environments. If you follow this advice, make sure that all the credentials for your development environment are different from your other deployments and that the development credentials do not have access to any confidential data.
|
222
245
|
|
223
246
|
### Why is it not overriding existing `ENV` variables?
|
data/lib/dotenv/rails.rb
CHANGED
@@ -9,8 +9,9 @@ require "dotenv"
|
|
9
9
|
#
|
10
10
|
# See https://github.com/bkeepers/dotenv/issues/219
|
11
11
|
if defined?(Rake.application)
|
12
|
-
|
13
|
-
|
12
|
+
if Rake.application.top_level_tasks.grep(/^(parallel:spec|spec(:|$))/).any?
|
13
|
+
Rails.env = ENV["RAILS_ENV"] ||= "test"
|
14
|
+
end
|
14
15
|
end
|
15
16
|
|
16
17
|
Dotenv.instrumenter = ActiveSupport::Notifications
|
@@ -51,8 +52,6 @@ module Dotenv
|
|
51
52
|
instance.load
|
52
53
|
end
|
53
54
|
|
54
|
-
config.before_configuration { load }
|
55
|
-
|
56
55
|
private
|
57
56
|
|
58
57
|
def dotenv_files
|
@@ -63,5 +62,7 @@ module Dotenv
|
|
63
62
|
root.join(".env")
|
64
63
|
].compact
|
65
64
|
end
|
65
|
+
|
66
|
+
config.before_configuration { load }
|
66
67
|
end
|
67
68
|
end
|
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.7.
|
4
|
+
version: 2.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Keepers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.7.
|
19
|
+
version: 2.7.3
|
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.7.
|
26
|
+
version: 2.7.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: railties
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|