dotenv-rails 2.7.2 → 2.7.4
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: d0df0bf40def6cddae1b3a3f00f8e62d126a3f0cf1c2bdd7a088f8d9828732f1
|
4
|
+
data.tar.gz: c4c7e734b53510171eaf5e1146c49284f384efff0d89effb85579168fd249274
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ba04b9211d3137e4bf6691cf0d618c13d93b96ba1f908e932dbe4a0c676b690202742cd6bcec11b57a83f83cef95ce75fdb43fccfc13f79f813311103a44611
|
7
|
+
data.tar.gz: 617af05f7735a9c25292fcd6d592ab37f4471727299fbe04d92966130ac7345834e7c155548505de9b57b404c7690447f994c1357cd52ff00cfc68e64e57179a
|
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.4
|
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-24 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.4
|
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.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: railties
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|