rails_environment_credentials 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0dbe6ee4c08f66d2ccc21c8ec65776aaddc9c0dbe8874672ab0bb57ff5f3acea
|
4
|
+
data.tar.gz: e4d07def0954a48b860bd914782e2f7518366b6d4676a0574a497e6788d70244
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64038d3477d7efc8c96b7db81d34ecb9ec3113e5c4a17acfd51e4be230353937a63f8d128993a782c33584756b1cdd13e3779f15c2cc0bb9f05ff4d9491a4a7f
|
7
|
+
data.tar.gz: 31729b37d94a6360f12258124033be1aad7fe944d4ca2b56c699afe3383b28bea1f6664f37b53f72ca78612454864bdadf90057d976e3e8f03e8b5f6f4da548e
|
@@ -1,6 +1,36 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module RailsEnvironmentCredentials
|
4
|
+
class CredentialsConfig < ActiveSupport::OrderedOptions
|
5
|
+
|
6
|
+
def environment
|
7
|
+
super || default_credentials_environment
|
8
|
+
end
|
9
|
+
|
10
|
+
def content_path
|
11
|
+
super || default_credentials_content_path
|
12
|
+
end
|
13
|
+
|
14
|
+
def key_path
|
15
|
+
super || default_credentials_key_path
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def default_credentials_environment
|
21
|
+
ENV.fetch('RAILS_CREDENTIALS_ENV') { Rails.env }
|
22
|
+
end
|
23
|
+
|
24
|
+
def default_credentials_content_path
|
25
|
+
Rails.root.join('config', 'credentials', "#{environment}.yml.enc")
|
26
|
+
end
|
27
|
+
|
28
|
+
def default_credentials_key_path
|
29
|
+
Rails.root.join('config', 'credentials', "#{environment}.key")
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
4
34
|
module Configuration
|
5
35
|
extend ActiveSupport::Concern
|
6
36
|
|
@@ -10,11 +40,9 @@ module RailsEnvironmentCredentials
|
|
10
40
|
|
11
41
|
def initialize(*)
|
12
42
|
super
|
13
|
-
@credentials =
|
43
|
+
@credentials = CredentialsConfig.new
|
14
44
|
@credentials.merge! credentials_config
|
15
|
-
|
16
|
-
@credentials.content_path ||= default_credentials_content_path
|
17
|
-
@credentials.key_path ||= default_credentials_key_path
|
45
|
+
|
18
46
|
end
|
19
47
|
|
20
48
|
private
|
@@ -24,17 +52,5 @@ module RailsEnvironmentCredentials
|
|
24
52
|
@credentials_config ||= (path.exist? ? YAML.safe_load(path.read) : {}).symbolize_keys
|
25
53
|
end
|
26
54
|
|
27
|
-
def default_credentials_environment
|
28
|
-
ENV.fetch('RAILS_CREDENTIALS_ENV') { Rails.env }
|
29
|
-
end
|
30
|
-
|
31
|
-
def default_credentials_content_path
|
32
|
-
root.join('config', 'credentials', "#{credentials.environment}.yml.enc")
|
33
|
-
end
|
34
|
-
|
35
|
-
def default_credentials_key_path
|
36
|
-
root.join('config', 'credentials', "#{credentials.environment}.key")
|
37
|
-
end
|
38
|
-
|
39
55
|
end
|
40
56
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_environment_credentials
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taylor Yelverton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|