configuration_service 1.1.3 → 1.1.4

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: de4118ee11bfbd8f76259b05fbda31dbf481299c
4
- data.tar.gz: 26fba382d4d73c3a0c21d1f075283b5d273812ed
3
+ metadata.gz: 6cd9fc6de7766ed90bd9dd238497c725b395fe4b
4
+ data.tar.gz: 8e3153bef43bac67e3f8b7a1e43978a42536616d
5
5
  SHA512:
6
- metadata.gz: 7d59aed18c4849e4a52d32903a39a1035e4fbde97d408a5740a05e094e67e7bacd811c048e226b15e1e4a981fed0cddee5d325146f31b534feecc9ca874464ba
7
- data.tar.gz: af4b66d5b7617316b8f12fd5be263261b4caa891fb3f0c59dadfbd188a760dfc4b95b1ba007cd78de896123b3c4bd30feddc7c9034b307acf9e5ba92aad950ea
6
+ metadata.gz: f3e144c0799f65f1f979d66cbd80d58605a0a0a744650c3a32542e7a7273abeb44a728ea0552868fb3480c9babff8fd0a862fae6d1957d1566da9db00d52adfe
7
+ data.tar.gz: 0a995102ba7f9bd104450093b4dd9f828740ff63503464d5bc74abb1cf48777897809e92c8c4ffc09278c4dcf3673758393a8af9ed9121cfbbf4e6d8c2e207c0
data/README.md CHANGED
@@ -4,7 +4,9 @@ The configuration service provides authorized publication and consumption of ide
4
4
 
5
5
  ## Documentation
6
6
 
7
- Comprehensive rdoc documentation is available:
7
+ For documentation of the released gems, see the [rubygems](https://rubygems.org/gems/configuration_service) documentation link.
8
+
9
+ To generate documentation for the master branch:
8
10
 
9
11
  ```shell
10
12
  git clone git@github.com:hetznerZA/configuration_service.git
data/README.rdoc CHANGED
@@ -14,4 +14,71 @@ allows for implementations that are not providers to the Ruby API.
14
14
  See ConfigurationService::Test.
15
15
 
16
16
  A stub service provider is provided in
17
- ConfigurationService::Provider::Stub.
17
+ ConfigurationService::Provider::Stub. Other providers are avialable as gems.
18
+
19
+ Service providers are registered against the
20
+ ConfigurationService::ProviderRegistry.
21
+
22
+ Factories for creating and configuring service instances are provided in
23
+ ConfigurationService::Factory.
24
+
25
+ == Usage
26
+
27
+ The recommended approach to creating a configuration service client is to use
28
+ a Factory.
29
+
30
+ For example, we can use the EnvironmentContext factory to create and configure
31
+ a configuration service client backed by the vault provider as follows.
32
+
33
+ Our +main.rb+ (or +config.ru+ or whatever) is simple:
34
+
35
+ require 'bundler'
36
+ Bundler.require(:default)
37
+
38
+ service = ConfigurationService::Factory::EnvironmentContext.create
39
+ if configuraton = service.request_configuration
40
+ AcmeApplication.new(configuration.data).run
41
+ else
42
+ raise "configuration not found"
43
+ end
44
+
45
+ This relies on a bundler Gemfile to load the gem that contains whatever
46
+ service provider we configure in the environment:
47
+
48
+ source 'https://rubygems.org'
49
+
50
+ gem 'configuration_service-provider-vault'
51
+ gem 'acme_application'
52
+
53
+ Now we use the process environment to configure the EnvironmentContext factory:
54
+
55
+ CFGSRV_IDENTIFIER="acme" \
56
+ CFGSRV_TOKEN="0b2a80f4-54ce-45f4-8267-f6558fee64af" \
57
+ CFGSRV_PROVIDER="vault" \
58
+ CFGSRV_PROVIDER_ADDRESS="http://127.0.0.1:8200" \
59
+ bundle exec main.rb
60
+
61
+ Note that +main.rb+ is completely decoupled from the selection of provider and
62
+ provider configuration. We could swap and/or reconfigure the provider by
63
+ manipulating only the Gemfile and the environment.
64
+
65
+ If you prefer to hard-code everything, or if your strategy for bootstrapping
66
+ the configuration service isn't expressed by an existing factory yet, you can
67
+ construct the service yourself:
68
+
69
+ require 'configuration_service/provider/vault'
70
+ require 'acme_application'
71
+
72
+ service = ConfigurationService.new(
73
+ "acme",
74
+ "0b2a80f4-54ce-45f4-8267-f6558fee64af",
75
+ ConfigurationService::Provider::Vault.new(
76
+ address: "http://127.0.0.1:8200"
77
+ )
78
+ )
79
+ if configuraton = service.request_configuration
80
+ AcmeApplication.new(configuration.data).run
81
+ else
82
+ raise "configuration not found"
83
+ end
84
+
@@ -1,5 +1,5 @@
1
1
  module ConfigurationService
2
2
 
3
- VERSION = "1.1.3"
3
+ VERSION = "1.1.4"
4
4
 
5
5
  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.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sheldon Hearn