credentials_for_rails_env 0.1.1 → 0.1.2
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/Gemfile.lock +3 -1
- data/README.md +37 -4
- data/credentials_for_rails_env.gemspec +1 -0
- data/lib/credentials_for_rails_env.rb +5 -11
- data/lib/credentials_for_rails_env/version.rb +1 -1
- data/lib/rails/application/credentials_env.rb +9 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9aff582c5235a95b2f69881a44ccf9ce60952f550e597e6fc65860ccdc535978
|
4
|
+
data.tar.gz: 462df324f45466b15a426b59fb5cf21088dc0dc00acc2385cbabeb4a5e59b79c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6804f1a48407a57ff049fcfa4f218e307601df3a801398bc29a126682c0704aa1832e16356292fc732faadd002607ee5ccf1d03e605e0b2e54bd944db54f2a84
|
7
|
+
data.tar.gz: 109a1487e1b1cb8742fc9e251b3ecc34f34f464a4659d1e39e41e09dd0c6f879630533899015125b2d9a0883bcaeae24a94c05058e824f20171f3526a43f314c
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
credentials_for_rails_env (0.1.
|
4
|
+
credentials_for_rails_env (0.1.2)
|
5
5
|
rails (>= 5.2)
|
6
6
|
|
7
7
|
GEM
|
@@ -50,6 +50,7 @@ GEM
|
|
50
50
|
tzinfo (~> 1.1)
|
51
51
|
arel (9.0.0)
|
52
52
|
builder (3.2.3)
|
53
|
+
byebug (10.0.2)
|
53
54
|
concurrent-ruby (1.0.5)
|
54
55
|
crass (1.0.4)
|
55
56
|
diff-lcs (1.3)
|
@@ -134,6 +135,7 @@ PLATFORMS
|
|
134
135
|
|
135
136
|
DEPENDENCIES
|
136
137
|
bundler (~> 1.16)
|
138
|
+
byebug
|
137
139
|
credentials_for_rails_env!
|
138
140
|
rake (~> 10.0)
|
139
141
|
rspec (~> 3.0)
|
data/README.md
CHANGED
@@ -1,8 +1,36 @@
|
|
1
1
|
# CredentialsForRailsEnv
|
2
2
|
|
3
|
-
|
3
|
+
Now you can easily fetch different credentials for the each of your RAILS_ENV environments. The new Rails.application.credentials_env method does the work for you. Here is a sample credentials file.
|
4
4
|
|
5
|
-
|
5
|
+
```yaml
|
6
|
+
$ EDITOR=vi rails credentials:edit
|
7
|
+
```
|
8
|
+
|
9
|
+
```yaml
|
10
|
+
foo: global foo
|
11
|
+
development:
|
12
|
+
foo: development foo
|
13
|
+
production:
|
14
|
+
foo: production foo
|
15
|
+
```
|
16
|
+
|
17
|
+
The new credentials_env method will return values from the RAILS_ENV slice of the credentials. For example if RAILS_ENV == "development":
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
Rails.application.credentials_env.foo => "development foo"
|
21
|
+
Rails.application.credentials_env[:foo] => "development foo"
|
22
|
+
Rails.application.credentials_env.fetch(:foo) => "development foo"
|
23
|
+
Rails.application.credentials_env.config =>
|
24
|
+
{ foo: "development foo" }
|
25
|
+
```
|
26
|
+
|
27
|
+
This makes it very easy to migrate from the deprecated Rails 5.1 secrets convention to the new Rails 5.2 credentials convention. Just add the contents of your secrets file to your credentials file and replace all calls to "Rails.application.secrets" with calls to "Rails.application.credentials_env".
|
28
|
+
|
29
|
+
You can still call "Rails.application.credentials" as usual.
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
Rails.application.credentials.foo => "global foo"
|
33
|
+
```
|
6
34
|
|
7
35
|
## Installation
|
8
36
|
|
@@ -22,7 +50,12 @@ Or install it yourself as:
|
|
22
50
|
|
23
51
|
## Usage
|
24
52
|
|
25
|
-
|
53
|
+
```ruby
|
54
|
+
Rails.application.credentials_env.foo
|
55
|
+
Rails.application.credentials_env[:foo]
|
56
|
+
Rails.application.credentials_env.fetch(:foo)
|
57
|
+
Rails.application.credentials_env.config
|
58
|
+
```
|
26
59
|
|
27
60
|
## Development
|
28
61
|
|
@@ -32,7 +65,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
65
|
|
33
66
|
## Contributing
|
34
67
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
68
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/jgorman/credentials_for_rails_env.
|
36
69
|
|
37
70
|
## License
|
38
71
|
|
@@ -1,12 +1,6 @@
|
|
1
|
-
|
2
|
-
require "active_support/fetch_rails_env"
|
3
|
-
require "credentials_for_rails_env/version"
|
1
|
+
# Rails.application.credentials_env fetches Rails.env slice of the credentials.
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
@credentials_env ||= ActiveSupport::FetchRailsEnv.new(credentials)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
3
|
+
require "credentials_for_rails_env/version"
|
4
|
+
require "active_support/fetch_rails_env"
|
5
|
+
require "rails/application"
|
6
|
+
require "rails/application/credentials_env"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: credentials_for_rails_env
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Gorman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: byebug
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: Fetch the current RAILS_ENV specific credentials from Rails.application.credentials_env.foo
|
70
84
|
just like Rails.application.secrets.foo.
|
71
85
|
email:
|
@@ -88,6 +102,7 @@ files:
|
|
88
102
|
- lib/active_support/fetch_rails_env.rb
|
89
103
|
- lib/credentials_for_rails_env.rb
|
90
104
|
- lib/credentials_for_rails_env/version.rb
|
105
|
+
- lib/rails/application/credentials_env.rb
|
91
106
|
homepage: https://github.com/jgorman/credentials_for_rails_env
|
92
107
|
licenses:
|
93
108
|
- MIT
|