configuration_service-provider-vault 2.0.16 → 2.0.18
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/.gemspec +2 -2
- data/README.md +5 -7
- data/README.rdoc +1 -1
- data/contrib/authorize.rb +27 -3
- data/contrib/publish.rb +20 -3
- data/contrib/request.rb +26 -3
- data/lib/configuration_service/provider/vault/version.rb +1 -1
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 058fc4e59ce0de10cbe65d7e1fa01c9fc7f5d3cd
|
4
|
+
data.tar.gz: 64f97bf254370a8c2e231c4cf993390e2425a7bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc2ccdfc0af60f58e5ec41f721c292c53682c0b5c71f8df482d96c46ff134f3864e5b727202edbce95ec4c9a41a995939ddd2038cd8b7c77435c5f9c83d1db80
|
7
|
+
data.tar.gz: 44fdbc51e11a4cec9e91997dc7a50c6b98b89d9a667dc4996da3cd23ddea4cecff7db4dd604448f067b7bcd58f35d4a4da0bbcdb73cdbb1ccae4616d6271001d
|
data/.gemspec
CHANGED
@@ -20,8 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.required_ruby_version = '>= 2.0'
|
22
22
|
|
23
|
-
spec.add_dependency "vault", "~> 0.
|
24
|
-
spec.add_dependency "configuration_service", "~> 2.
|
23
|
+
spec.add_dependency "vault", "~> 0.4"
|
24
|
+
spec.add_dependency "configuration_service", "~> 2.2.0"
|
25
25
|
spec.add_development_dependency "bundler", "~> 1.7"
|
26
26
|
spec.add_development_dependency "rake", "~> 10.0"
|
27
27
|
spec.add_development_dependency "cucumber", "~> 2.0"
|
data/README.md
CHANGED
@@ -41,12 +41,10 @@ do not be surprised when you find no feature files in the `features` subdirector
|
|
41
41
|
|
42
42
|
The recommended approach to creating a configuration service client is to use a factory
|
43
43
|
from the [configuration_service](https://rubygems.org/gems/configuration_service) gem.
|
44
|
-
See the documentation for
|
45
|
-
available factories.
|
44
|
+
See the documentation for ConfigurationService::Factory.
|
46
45
|
|
47
|
-
For example, we can use the
|
48
|
-
|
49
|
-
follows.
|
46
|
+
For example, we can use the factory to create and configure a configuration service client
|
47
|
+
backed by the vault provider as follows.
|
50
48
|
|
51
49
|
Our `main.rb` (or `config.ru` or whatever) is simple:
|
52
50
|
|
@@ -54,7 +52,7 @@ Our `main.rb` (or `config.ru` or whatever) is simple:
|
|
54
52
|
require 'bundler'
|
55
53
|
Bundler.require(:default)
|
56
54
|
|
57
|
-
service = ConfigurationService::Factory
|
55
|
+
service = ConfigurationService::Factory.create_client
|
58
56
|
configuraton = service.request_configuration
|
59
57
|
AcmeApplication.new(configuration.data).run
|
60
58
|
```
|
@@ -69,7 +67,7 @@ gem 'configuration_service-provider-vault'
|
|
69
67
|
gem 'acme_application'
|
70
68
|
```
|
71
69
|
|
72
|
-
Now we use the process environment to configure the EnvironmentContext factory:
|
70
|
+
Now we use the process environment to configure the EnvironmentContext used by the factory:
|
73
71
|
|
74
72
|
```shell
|
75
73
|
CFGSRV_IDENTIFIER="acme" \
|
data/README.rdoc
CHANGED
@@ -20,7 +20,7 @@ Our +main.rb+ (or +config.ru+ or whatever) is simple:
|
|
20
20
|
require 'bundler'
|
21
21
|
Bundler.require(:default)
|
22
22
|
|
23
|
-
config_service = ConfigurationService::Factory
|
23
|
+
config_service = ConfigurationService::Factory.create_client
|
24
24
|
config = config_service.request_configuration
|
25
25
|
|
26
26
|
$stderr.puts "Using configuration #{config.identifier} #{config.metadata}..."
|
data/contrib/authorize.rb
CHANGED
@@ -5,11 +5,34 @@ require "configuration_service/test/vault_admin_client"
|
|
5
5
|
|
6
6
|
require "yaml"
|
7
7
|
|
8
|
-
|
9
|
-
$stderr.puts "usage: #{PROGNAME} identifier"
|
8
|
+
def usage
|
9
|
+
$stderr.puts "usage: #{PROGNAME} [{-j|-y}] identifier"
|
10
|
+
$stderr.puts
|
11
|
+
$stderr.puts " -j presents the authorization as JSON"
|
12
|
+
$stderr.puts " -y presents the authorization as YAML (default)"
|
10
13
|
exit(1)
|
11
14
|
end
|
12
15
|
|
16
|
+
if ARGV.size < 1 or ARGV.size > 2
|
17
|
+
usage
|
18
|
+
end
|
19
|
+
|
20
|
+
json_formatter = ->(data) { JSON.pretty_generate(data) }
|
21
|
+
yaml_formatter = ->(data) { YAML.dump(data) }
|
22
|
+
|
23
|
+
case
|
24
|
+
when ARGV[0] == '-j'
|
25
|
+
formatter = json_formatter
|
26
|
+
ARGV.shift
|
27
|
+
when ARGV[0] == '-y'
|
28
|
+
formatter = yaml_formatter
|
29
|
+
ARGV.shift
|
30
|
+
when ARGV[0].start_with?('-')
|
31
|
+
usage
|
32
|
+
else
|
33
|
+
formatter = yaml_formatter
|
34
|
+
end
|
35
|
+
|
13
36
|
%w[VAULT_TOKEN VAULT_ADDR].each do |e|
|
14
37
|
unless ENV[e]
|
15
38
|
$stderr.puts "#{PROGNAME}: error: missing environment variable #{e}"
|
@@ -27,4 +50,5 @@ response = {
|
|
27
50
|
"CFGSRV_PROVIDER" => "vault",
|
28
51
|
"CFGSRV_PROVIDER_ADDRESS" => ENV["VAULT_ADDR"],
|
29
52
|
}
|
30
|
-
puts
|
53
|
+
$stderr.puts "# Partial token: #{token[0,3]}...#{token[-3,3]}"
|
54
|
+
puts formatter[response]
|
data/contrib/publish.rb
CHANGED
@@ -4,9 +4,14 @@ PROGNAME = File.basename(__FILE__)
|
|
4
4
|
require "configuration_service/provider/vault"
|
5
5
|
|
6
6
|
require "yaml"
|
7
|
+
require "json"
|
7
8
|
|
8
|
-
if ARGV.size
|
9
|
-
$stderr.puts "usage: #{PROGNAME} identifier yaml_file"
|
9
|
+
if ARGV.size < 1 or ARGV.size > 2
|
10
|
+
$stderr.puts "usage: #{PROGNAME} identifier [{json_file|yaml_file}]"
|
11
|
+
$stderr.puts
|
12
|
+
$stderr.puts " The file should contain the configuration data dictionary."
|
13
|
+
$stderr.puts " If a file is not specified, YAML or JSON data will be read from stdin."
|
14
|
+
$stderr.puts " Providing metadata is currently not supported."
|
10
15
|
exit(1)
|
11
16
|
end
|
12
17
|
|
@@ -18,7 +23,19 @@ end
|
|
18
23
|
end
|
19
24
|
|
20
25
|
identifier = ARGV[0]
|
21
|
-
|
26
|
+
|
27
|
+
if ARGV.size < 2
|
28
|
+
raw_data = $stdin.read
|
29
|
+
else
|
30
|
+
raw_data = File.read(ARGV[1])
|
31
|
+
end
|
32
|
+
|
33
|
+
data = begin
|
34
|
+
YAML.load(raw_data)
|
35
|
+
rescue
|
36
|
+
JSON.parse(raw_data)
|
37
|
+
end
|
38
|
+
|
22
39
|
service = ConfigurationService::Base.new(
|
23
40
|
identifier,
|
24
41
|
ENV["VAULT_TOKEN"],
|
data/contrib/request.rb
CHANGED
@@ -5,11 +5,34 @@ require "configuration_service/provider/vault"
|
|
5
5
|
|
6
6
|
require "yaml"
|
7
7
|
|
8
|
-
|
9
|
-
$stderr.puts "usage: #{PROGNAME} identifier"
|
8
|
+
def usage
|
9
|
+
$stderr.puts "usage: #{PROGNAME} [{-j|-y}] identifier"
|
10
|
+
$stderr.puts
|
11
|
+
$stderr.puts " -j presents the data as JSON"
|
12
|
+
$stderr.puts " -y presents the data as YAML (default)"
|
10
13
|
exit(1)
|
11
14
|
end
|
12
15
|
|
16
|
+
if ARGV.size < 1 or ARGV.size > 2
|
17
|
+
usage
|
18
|
+
end
|
19
|
+
|
20
|
+
json_formatter = ->(data) { JSON.pretty_generate(data) }
|
21
|
+
yaml_formatter = ->(data) { YAML.dump(data) }
|
22
|
+
|
23
|
+
case
|
24
|
+
when ARGV[0] == '-j'
|
25
|
+
formatter = json_formatter
|
26
|
+
ARGV.shift
|
27
|
+
when ARGV[0] == '-y'
|
28
|
+
formatter = yaml_formatter
|
29
|
+
ARGV.shift
|
30
|
+
when ARGV[0].start_with?('-')
|
31
|
+
usage
|
32
|
+
else
|
33
|
+
formatter = yaml_formatter
|
34
|
+
end
|
35
|
+
|
13
36
|
%w[VAULT_TOKEN VAULT_ADDR].each do |e|
|
14
37
|
unless ENV[e]
|
15
38
|
$stderr.puts "#{PROGNAME}: error: missing environment variable #{e}"
|
@@ -27,4 +50,4 @@ service = ConfigurationService::Base.new(
|
|
27
50
|
)
|
28
51
|
|
29
52
|
configuration = service.request_configuration
|
30
|
-
puts configuration.data
|
53
|
+
puts formatter[configuration.data]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configuration_service-provider-vault
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sheldon Hearn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: vault
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.4'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: configuration_service
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: 2.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.
|
40
|
+
version: 2.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -152,4 +152,3 @@ signing_key:
|
|
152
152
|
specification_version: 4
|
153
153
|
summary: Vault provider for Configuration Service
|
154
154
|
test_files: []
|
155
|
-
has_rdoc:
|