muchkeys 0.7.0 → 0.7.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
  SHA1:
3
- metadata.gz: e81c8deded76555843a5242334ae71417521d1f3
4
- data.tar.gz: 3c71a228e84eb175b81cec46fa903140dcf76006
3
+ metadata.gz: 99f31bc721d5cc91d2e22d326c82bfd0a98def83
4
+ data.tar.gz: e9bc30d7ad9a81cb75c4e94eaa7e21ee0c27ecdf
5
5
  SHA512:
6
- metadata.gz: c635fa24d92c441d5e777238c3beed8472942704a8efb0d907e504ec2f72f08ad6ab6c5ee02ffe61bd81405b277c414a8341d1041e998cde631b85b7b16a896d
7
- data.tar.gz: 572192537944c62a1960be30603f9be0cc0e6de4a5383af8f4c271a47d9395a1a5cf30137d65260c6f667bff813e3617c061415f860b59ed25ca7e24f122815c
6
+ metadata.gz: e4da7727785879d4455f282c0521031d46a10b4a0d77c6d6820d4eaad2246d8e7c0a2472207f2c77cc20e7cab4a3362e4671acba7fae8795be42c5fb7f92acf6
7
+ data.tar.gz: 708b3dd75c7bc29a6d49ac78e08f18521145ecff997a263881230a7eb907c13087d0f34d5f9d3356ad886e5d44683a9899cb30d2e107d699d84362cc87f5ec88
@@ -1,6 +1,7 @@
1
1
  require "active_support/configurable"
2
2
  require "net/http"
3
3
  require "json"
4
+ require 'yaml'
4
5
 
5
6
  if defined? ::Rails
6
7
  require 'muchkeys/rails'
@@ -54,6 +55,19 @@ module Muchkeys
54
55
  File.read(check_dir.join(".env")).each_line.select(&:presence).map { |x| x.split("=")[0] }
55
56
  end
56
57
 
58
+ def self.configure_from_yaml(file)
59
+ app_config = YAML.load(File.read(file)).with_indifferent_access
60
+ Muchkeys.configure do |config|
61
+ config.application_name = app_config[:application_name] if app_config.has_key?(:application_name)
62
+ config.consul_url = app_config[:consul_url] if app_config.has_key?(:consul_url)
63
+ config.keys_dir = app_config[:keys_dir] if app_config.has_key?(:keys_dir)
64
+ config.private_key = app_config[:private_key] if app_config.has_key?(:private_key)
65
+ config.public_key = app_config[:public_key] if app_config.has_key?(:public_key)
66
+ config.search_paths = app_config[:search_paths] if app_config.has_key?(:search_paths)
67
+ config.secrets_hint = app_config[:secrets_hint] if app_config.has_key?(:secrets_hint)
68
+ end
69
+ end
70
+
57
71
  def self.populate_environment!(*required_keys)
58
72
  app = ApplicationClient.new(config)
59
73
  app.verify_keys(*required_keys)
@@ -1,17 +1,7 @@
1
1
  module Muchkeys
2
2
  class Rails < Rails::Railtie
3
3
  config.before_configuration do
4
- app_config = YAML.load(File.read(::Rails.root.join("config", "muchkeys.yml")))
5
- Muchkeys.configure do |config|
6
- config.application_name ||= app_config[:application_name] || ::Rails.application.class.parent_name.underscore
7
- config.consul_url ||= app_config[:consul_url] || "http://localhost:8500"
8
- config.keys_dir ||= app_config[:keys_dir]
9
- config.private_key ||= app_config[:private_key]
10
- config.public_key ||= app_config[:public_key]
11
- config.search_paths ||= app_config[:search_paths]
12
- config.secrets_hint ||= app_config[:secrets_hint]
13
- end
14
-
4
+ Muchkeys.configure_from_yaml(::Rails.root.join("config", "muchkeys.yml"))
15
5
  Muchkeys.populate_environment!(*Muchkeys.env_keys)
16
6
  end
17
7
  end
@@ -1,3 +1,3 @@
1
1
  module Muchkeys
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
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.7.0
4
+ version: 0.7.1
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-12-20 00:00:00.000000000 Z
12
+ date: 2016-12-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor