credentials_for_rails_env 1.0.0 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0484df2e3603dfe81ceed14aa0aeb5a143f00261ee8a5e857e7a0585f04bcff4'
4
- data.tar.gz: b14e146f694a717367c682668c9cb6bc17d2ac890d29ac87dc060eecbc226d33
3
+ metadata.gz: 78d5383e7b8cdd80b1f71e67458b4e011aefce866884f0097a19a319f3b740e7
4
+ data.tar.gz: 0f824a80f6efb86a5d84e96cc114f6d7d904d6de4e41128fcce9ca5a72a46673
5
5
  SHA512:
6
- metadata.gz: 804b5ed371ebfbb2a12e1612feddfa552021dd090c3d91473874370da46d03783fdfbe0c4f651f8a9daf2fb3d3851edd90d6f9da07797c95cad5077b9aaa975c
7
- data.tar.gz: 1d5fca391400aaada844febf682db0c52e0a289a16a45aa468560181975384d91fd699a34e0f2dcef2ce22db28faabf1cfa1266ea5bd6265c8acb8f285b72860
6
+ metadata.gz: 6986fcd834221e93dd32415a4916ddeee1e665047817e53a1705462adc4c7cc2ba0dce206204f203b8ce4b80fc3ab37428de81bbb218cb28c53ce8010c8fd17f
7
+ data.tar.gz: 9f6bdb04342eaf6916602221110f0967fa7c36283ec80f8ed7f7004085997b7e715957fc1af53795d3987354dc7e3e378988da7d3183f5075ec00e86ca19d9c6
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # CredentialsForRailsEnv
2
2
 
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.
3
+ Now you can easily fetch different credentials for the each of your RAILS_ENV environments. The new Rails.application.credentials.env object does the work for you. Here is a sample credentials file.
4
4
 
5
5
  ```yaml
6
6
  $ EDITOR=vim rails credentials:edit
@@ -14,7 +14,7 @@ production:
14
14
  foo: production foo
15
15
  ```
16
16
 
17
- The new credentials.env method will return values from the RAILS_ENV slice of the credentials. For example when RAILS_ENV == "development":
17
+ The new credentials.env object will return values from the RAILS_ENV slice of the credentials. For example when RAILS_ENV == "development":
18
18
 
19
19
  ```ruby
20
20
  Rails.application.credentials.env.foo => "development foo"
@@ -32,6 +32,31 @@ You can still call "Rails.application.credentials" as usual to see the global cr
32
32
  Rails.application.credentials.foo => "global foo"
33
33
  ```
34
34
 
35
+ This works by extending ActiveSupport::EncryptedConfiguration to take an optional rails_env parameter.
36
+
37
+ ```ruby
38
+ module Rails
39
+ class Application < Engine
40
+ def encrypted(path, key_path: "config/master.key", env_key: "RAILS_MASTER_KEY")
41
+ ActiveSupport::EncryptedConfiguration.new(
42
+ config_path: Rails.root.join(path),
43
+ key_path: Rails.root.join(key_path),
44
+ env_key: env_key,
45
+ raise_if_missing_key: config.require_master_key,
46
+ rails_env: Rails.env
47
+ )
48
+ end
49
+ end
50
+ end
51
+ ```
52
+
53
+ You can use this interface to open any encrypted file and access the RAILS_ENV specific configuration values.
54
+
55
+ ```ruby
56
+ my_credentials = Rails.application.encrypted("config/my_credentials.yml.enc")
57
+ my_bar = my_credentials.env.bar
58
+ ```
59
+
35
60
  ## Installation
36
61
 
37
62
  Add this line to your application's Gemfile:
@@ -1,3 +1,3 @@
1
1
  module CredentialsForRailsEnv
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
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: 1.0.0
4
+ version: 1.0.1
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-13 00:00:00.000000000 Z
11
+ date: 2018-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails