muchkeys 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/muchkeys/rails.rb +19 -0
- data/lib/muchkeys/version.rb +1 -1
- data/lib/muchkeys.rb +11 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78189f815bc07abd0764251e38f50d803325dd32
|
4
|
+
data.tar.gz: d1c41a5c3a82c5f2e97b4a434ee25f38ffaa7cff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb82cbe29730794b1bcc05005b9761b24723fc58fd551b70a7f3743ddd266ce9cebdd97b54ad9fdd783651c8785c3cb831835554c078039e19b8a1a7e9244bc3
|
7
|
+
data.tar.gz: 2ba20955c3daec345019303d176081881fa9da8a69837f4a2e1b7196635414d5d5eae1fd0be45651fb86c399aed3482a3c582b411b7bcdec2418c09503377777
|
data/README.md
CHANGED
@@ -270,7 +270,7 @@ It's sort of the opposite of `envconsul` or similar to `dotenv` designed
|
|
270
270
|
for use in production.
|
271
271
|
|
272
272
|
* Dotenv doesn't centralize keys.
|
273
|
-
* envconsul has
|
273
|
+
* envconsul has "an auto restart the launched process on change" feature, this project does not.
|
274
274
|
|
275
275
|
|
276
276
|
### Future
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class MuchKeys::Rails < Rails::Railtie
|
2
|
+
config.before_configuration do
|
3
|
+
MuchKeys.configure do |config|
|
4
|
+
config.application_name = Rails.application.class.parent_name.underscore
|
5
|
+
end
|
6
|
+
|
7
|
+
MuchKeys.populate_environment!(*env_keys)
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
def env_keys
|
12
|
+
# parse all environments found in .env and populate them from consul
|
13
|
+
unless File.exists?(Rails.root.join(".env"))
|
14
|
+
raise IOError, ".env files are required for Muchkeys ENV injection to work"
|
15
|
+
end
|
16
|
+
|
17
|
+
File.read(Rails.root.join(".env")).each_line.map { |x| x.split("=")[0] }
|
18
|
+
end
|
19
|
+
end
|
data/lib/muchkeys/version.rb
CHANGED
data/lib/muchkeys.rb
CHANGED
@@ -7,6 +7,10 @@ require "muchkeys/cli"
|
|
7
7
|
|
8
8
|
require "net/http"
|
9
9
|
|
10
|
+
if defined? Rails
|
11
|
+
require 'muchkeys/rails'
|
12
|
+
end
|
13
|
+
|
10
14
|
module MuchKeys
|
11
15
|
|
12
16
|
# revealing intention
|
@@ -23,6 +27,13 @@ module MuchKeys
|
|
23
27
|
end
|
24
28
|
end
|
25
29
|
|
30
|
+
def populate_environment!(*keys)
|
31
|
+
keys.each do |key|
|
32
|
+
ENV[key] = MuchKeys.find_first(key)
|
33
|
+
end
|
34
|
+
nil
|
35
|
+
end
|
36
|
+
|
26
37
|
# this is the entry point to the ENV-like object that devs will use
|
27
38
|
def find_first(key_name)
|
28
39
|
unless MuchKeys.configuration.search_paths
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: muchkeys
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pat O'Brien
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-09-
|
12
|
+
date: 2016-09-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- lib/muchkeys/configuration.rb
|
135
135
|
- lib/muchkeys/errors.rb
|
136
136
|
- lib/muchkeys/key_validator.rb
|
137
|
+
- lib/muchkeys/rails.rb
|
137
138
|
- lib/muchkeys/secret.rb
|
138
139
|
- lib/muchkeys/version.rb
|
139
140
|
- muchkeys.gemspec
|