configuration_service 1.1.1 → 1.1.2
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 +4 -4
- data/configuration_service.gemspec +1 -1
- data/lib/configuration_service/errors.rb +6 -0
- data/lib/configuration_service/factory/environment_context.rb +21 -4
- data/lib/configuration_service/factory/environment_context/env_dict.rb +1 -1
- data/lib/configuration_service/test/orchestrator.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4610fe57d04ebf9b414e4a1e714a4951bae72241
|
4
|
+
data.tar.gz: 071270662e7f96be1485bc94faa2a406ea9925b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e29d9cd857a188765e9253ac9f604b5f044adecaaeefacfd7c1edff7e96a0cb5199017359a4a121d8664e01926dd055b79836ec354b7418863941d33331f4de
|
7
|
+
data.tar.gz: bb14fb1e0df9b75616c25fce06d2ff67d5822e8f1da3b658ac975f7680653ff4d08dabc9bf51eced82671c101e668c34e8fa8b7d4b761c1634bee7b8f4d50f92
|
@@ -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
|
-
#
|
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!
|
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
|
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
|
@@ -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
|