configuration_service 1.1.1 → 1.1.2

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
  SHA1:
3
- metadata.gz: fc898eb1373d71883928bb492b533ffadc0e895c
4
- data.tar.gz: ec3e54e1a4768122bd1f0e14f77cfc8e6da36bed
3
+ metadata.gz: 4610fe57d04ebf9b414e4a1e714a4951bae72241
4
+ data.tar.gz: 071270662e7f96be1485bc94faa2a406ea9925b1
5
5
  SHA512:
6
- metadata.gz: 978bd8e5c8bd45ff27550378d5052bdadca16c72d4787fd88c5e5aca4a691b2906074b145e7123597cf5278a1e09932c5f33915857435b7c847ea6a2f6c51f4d
7
- data.tar.gz: 4cbd165b89b7f76886333c3ec414391cf8db0254e00e50e6ac67cdb77367d28324a5963b9eae22b5a49eff198c836e0fbafec10a1747df0808662c20e3e8531f
6
+ metadata.gz: 4e29d9cd857a188765e9253ac9f604b5f044adecaaeefacfd7c1edff7e96a0cb5199017359a4a121d8664e01926dd055b79836ec354b7418863941d33331f4de
7
+ data.tar.gz: bb14fb1e0df9b75616c25fce06d2ff67d5822e8f1da3b658ac975f7680653ff4d08dabc9bf51eced82671c101e668c34e8fa8b7d4b761c1634bee7b8f4d50f92
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "configuration_service"
7
- spec.version = "1.1.1"
7
+ spec.version = "1.1.2"
8
8
  spec.authors = ["Sheldon Hearn"]
9
9
  spec.email = ["sheldonh@starjuice.net"]
10
10
 
@@ -15,4 +15,10 @@ module ConfigurationService
15
15
  class AuthorizationError < Error
16
16
  end
17
17
 
18
+ ##
19
+ # A configuration service provider registry lookup error
20
+ #
21
+ class ProviderNotFoundError < Error
22
+ end
23
+
18
24
  end
@@ -12,9 +12,25 @@ module ConfigurationService
12
12
  # # CFGSRV_PROVIDER="vault"
13
13
  # # CFGSRV_PROVIDER_ADDRESS="http://127.0.0.1:8200"
14
14
  #
15
+ # # And the following in Gemfile:
16
+ # #
17
+ # # source 'https://rubygems.org'
18
+ # #
19
+ # # gem 'configuration_service-vault'
20
+ # # gem 'acme_application'
21
+ #
22
+ # # Now main.rb (or config.ru or whatever) is decoupled from provider
23
+ # # selection and service configuration:
24
+ #
25
+ # require 'bundler'
26
+ # Bundler.require(:default) # Registers the vault provider
27
+ #
15
28
  # service = ConfigurationService::Factory::EnvironmentContext.create
16
- # configuraton = service.request_configuration
17
- # AcmeApplication.new(configuration.data).run
29
+ # if configuraton = service.request_configuration
30
+ # AcmeApplication.new(configuration.data).run
31
+ # else
32
+ # raise "configuration not found"
33
+ # end
18
34
  #
19
35
  class EnvironmentContext
20
36
 
@@ -75,7 +91,7 @@ module ConfigurationService
75
91
  #
76
92
  def create
77
93
  ConfigurationService.new(@env[:identifier], @env[:token], provider).tap do
78
- @env.scrub! # TODO mandates that scrub not try to mutate the strings given to provider
94
+ @env.scrub!
79
95
  end
80
96
  end
81
97
 
@@ -96,7 +112,8 @@ module ConfigurationService
96
112
  provider_id = @env[:provider]
97
113
  provider_config = @env.subslice(:provider)
98
114
  provider_class = ConfigurationService::ProviderRegistry.instance.lookup(provider_id)
99
- provider_class.new(provider_config) # TODO mandates keyword arguments or options hash
115
+ provider_class or raise ProviderNotFoundError, "provider not registered: #{provider_id}"
116
+ provider_class.new(provider_config)
100
117
  end
101
118
 
102
119
  end
@@ -4,7 +4,7 @@ module ConfigurationService
4
4
 
5
5
  class EnvironmentContext
6
6
 
7
- class EnvDict < Hash # :nodoc: all
7
+ class EnvDict < Hash # :nodoc:
8
8
 
9
9
  def initialize(env, *path)
10
10
  @env = env
@@ -162,6 +162,7 @@ module ConfigurationService
162
162
  # True if the last consuming operation did not return data
163
163
  #
164
164
  # TODO: distinguish #request_not_matched? to mean "found data, but filtered out by metadata filter"
165
+ #
165
166
  def request_not_matched?
166
167
  not @response.found?
167
168
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: configuration_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sheldon Hearn