creds 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: 675d4d8f73dfd10878a3fb84e38e1ce88efcf6436a04288503289ea3715fe50f
4
- data.tar.gz: '0285d076061d1caef7ae2b8c838fdc0a6bc4aafdfd3d8f8231c7e27300819c70'
3
+ metadata.gz: 9231cfcb9ee46f7178ba33a009dec23e20fa329bb124a7ce21b999f441fa1ceb
4
+ data.tar.gz: efd6de47e0242203f6cb8fbc28621499b64ff2e2cdfcc739d19359b31cf8f74a
5
5
  SHA512:
6
- metadata.gz: b8d140456a101e38d6c1fa58acca7b1f7fe374d5a2196a2ae718c8c685fa4f7cb89bf20171f715dcac7b7e84048abdb852e5b2e91d1bb12eb9b0c0a0ed8865c0
7
- data.tar.gz: 8805688a00485cc4c55733c730a0da5216025b1cfae94784ad6aa42282d4783508d4ebee7dfe92a03ae37a0376a86bfa6489a99736c05b4d9e85e1ddee6227cf
6
+ metadata.gz: 7b24d7b241e05bd17a19c19805baebd59c13a8f6bddb6b377833f18757940b7d5ae489ef2ccdc1845393878eeefcc542b89bcdfa2395e7a0486fd1409175f601
7
+ data.tar.gz: e736ea8764447a1813f43b553a24368826a0da9169cbb2741e1598a5d47c5d9be6b751b940117ed854852571b7b7f1cb448a538789c162abf823c0eebad5ab58
@@ -1,9 +1,12 @@
1
- sudo: false
1
+ dist: xenial
2
2
  language: ruby
3
3
  cache: bundler
4
4
  rvm:
5
- - 2.5.1
6
- before_install: gem install bundler
5
+ - 2.5.3
6
+ - 2.6.3
7
+ before_install:
8
+ - gem update --system
9
+ - gem install bundler
7
10
  notifications:
8
11
  disabled: true
9
12
  script:
data/Gemfile CHANGED
@@ -1,6 +1,4 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
3
  # Specify your gem's dependencies in creds.gemspec
6
4
  gemspec
@@ -1,22 +1,22 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- creds (1.0.0)
4
+ creds (1.0.1)
5
5
  activesupport (>= 5.2.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activesupport (5.2.0)
10
+ activesupport (5.2.3)
11
11
  concurrent-ruby (~> 1.0, >= 1.0.2)
12
12
  i18n (>= 0.7, < 2)
13
13
  minitest (~> 5.1)
14
14
  tzinfo (~> 1.1)
15
- concurrent-ruby (1.0.5)
16
- i18n (1.0.0)
15
+ concurrent-ruby (1.1.5)
16
+ i18n (1.6.0)
17
17
  concurrent-ruby (~> 1.0)
18
18
  minitest (5.11.3)
19
- rake (12.3.1)
19
+ rake (12.3.2)
20
20
  thread_safe (0.3.6)
21
21
  tzinfo (1.2.5)
22
22
  thread_safe (~> 0.1)
@@ -31,4 +31,4 @@ DEPENDENCIES
31
31
  rake (>= 10.0)
32
32
 
33
33
  BUNDLED WITH
34
- 1.16.1
34
+ 2.0.1
data/README.md CHANGED
@@ -10,7 +10,7 @@ Available as a gem [`creds`](https://rubygems.org/gems/creds)
10
10
 
11
11
  Using Rails command, generate new encrypted file by
12
12
  ```
13
- bin/rails encrypted:edit config/credentials-production.yml.enc --key config/master-production.key
13
+ bin/rails encrypted:edit config/credentials/production.yml.enc --key config/credentials/production.key
14
14
  ```
15
15
 
16
16
  add some content in opened editor (note there is no environment root key, ie no `production`):
@@ -18,15 +18,20 @@ add some content in opened editor (note there is no environment root key, ie no
18
18
  aws_access_key_id: my-access-key-id
19
19
  ```
20
20
 
21
- If `config/master-production.key` doesn't exist yet, run `bin/rails generate master_key` and adjust naming to match desired one.
21
+ If `config/credentials/production.key` doesn't exist yet, run `bin/rails generate master_key` and adjust naming to match desired one.
22
22
  Content of file can be displayed by
23
23
  ```
24
- bin/rails encrypted:show config/credentials-production.yml.enc --key config/master-production.key
24
+ bin/rails encrypted:show config/credentials/production.yml.enc --key config/credentials/production.key
25
25
  ```
26
26
 
27
27
  Add to `config/environments/production.rb` (or any other env)
28
28
  ```ruby
29
- config.creds = Creds.new("config/credentials-production.yml.enc")
29
+ config.creds = Creds.new("config/credentials/production.yml.enc")
30
+ ```
31
+
32
+ If wants to use key from custom path - by default it checks `RAILS_MASTER_KEY` env key and `config/master.key` file:
33
+ ```ruby
34
+ config.creds = Creds.new("config/credentials/production.yml.enc", key_path: "config/credentials/production.key")
30
35
  ```
31
36
 
32
37
  In the code:
@@ -34,7 +39,7 @@ In the code:
34
39
  Rails.configuration.creds.aws_access_key_id
35
40
  ```
36
41
 
37
- To ease working in development/test environments with the same API, add `config/credentials-plain.yml` with key/value pairs
42
+ To ease working in development/test environments with the same API, add `config/credentials/plain.yml` with key/value pairs
38
43
  nested under environment name, like:
39
44
  ```yml
40
45
  development:
@@ -43,9 +48,14 @@ development:
43
48
 
44
49
  Then add to `config/environments/development.rb`
45
50
  ```ruby
46
- config.creds = Creds.new("config/credentials-plain.yml", env: "development")
51
+ config.creds = Creds.new("config/credentials/plain.yml", env: "development")
47
52
  ```
48
53
 
54
+ ### Rails 6.0
55
+
56
+ In Rails 6.0 it is possible to edit files by `rails credentials:edit --environment production` which will look for
57
+ `config/credentials/production.yml.enc` encrypted by `ENV["RAILS_MASTER_KEY"]` or `config/credentials/production.key`
58
+
49
59
  ### Additions
50
60
 
51
61
  * To raise error in case of missing key you can add bang to the name, like `Rails.configuration.creds.database_url!`
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Wojciech Wnętrzak"]
10
10
  spec.email = ["w.wnetrzak@gmail.com", "eng@freeletics.com"]
11
11
 
12
- spec.summary = %q{Encrypted Credentials for multiple environments}
12
+ spec.summary = %q{Encrypted credentials for multiple environments}
13
13
  spec.description = %q{Unified interface for encrypted credentials and plain text file based}
14
14
  spec.homepage = "https://github.com/freeletics/creds"
15
15
  spec.license = "MIT"
@@ -1,7 +1,6 @@
1
1
  require "creds/version"
2
2
  require "creds/plain_configuration"
3
3
 
4
- require "active_support/core_ext/module/attribute_accessors" # https://github.com/rails/rails/pull/32383
5
4
  require "active_support/core_ext/module/delegation"
6
5
  require "active_support/encrypted_configuration"
7
6
 
@@ -18,6 +17,10 @@ class Creds
18
17
  @env = env
19
18
  end
20
19
 
20
+ def [](key)
21
+ configuration[key.to_sym]
22
+ end
23
+
21
24
  def configuration
22
25
  @configuration ||= if @file_path.end_with?(".enc")
23
26
  ActiveSupport::EncryptedConfiguration.new(
@@ -1,3 +1,3 @@
1
1
  class Creds
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: creds
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
  - Wojciech Wnętrzak
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-04-10 00:00:00.000000000 Z
11
+ date: 2019-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -107,9 +107,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  - !ruby/object:Gem::Version
108
108
  version: '0'
109
109
  requirements: []
110
- rubyforge_project:
111
- rubygems_version: 2.7.6
110
+ rubygems_version: 3.0.3
112
111
  signing_key:
113
112
  specification_version: 4
114
- summary: Encrypted Credentials for multiple environments
113
+ summary: Encrypted credentials for multiple environments
115
114
  test_files: []