doppler-client 0.1.0 → 0.1.1

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: 0005c526c987258aa40d99de9422ee0dab1f860b
4
- data.tar.gz: aced88db3201f39196f80c45b12df60d55601164
3
+ metadata.gz: 3d7f6b03743332da764917f49710df2b127cb344
4
+ data.tar.gz: 29877f453214135f86556bed11be6991fe329ff6
5
5
  SHA512:
6
- metadata.gz: 137d60cb4d959afada4875c5979a596e9e021d925f5f33348d7aa47ac719b6c3e754081861f782a68e38b9b6a2310cef41e4d7743fb11b524bfad5092ec5d18c
7
- data.tar.gz: bdfac15d1646ca889815d71f25010823990a5a03a29de8c553db9554f39171d89b7c39ef9d81682bed1f40e98a75709c90b77546c4fd033dc2524b650632fb2d
6
+ metadata.gz: 433a86772655ccfd58e78f3ba29d058c5a23c1671a242d2667dfd1a312cb87bed2a9876f5ab2c46912e564d4628b28794c3f2b5143dbbc4895dd270e0ac8f048
7
+ data.tar.gz: 9a890472004451d05d85f8d20694cb0eac73839be203aecf92da59f66f3412b73bd46b2794714f25f124727196928366f6aea5d0771704f3a61ee640a7a71c9b
data/Gemfile.lock ADDED
@@ -0,0 +1,24 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ doppler-client (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ hitimes (1.3.0)
10
+ minitest (5.11.3)
11
+ rake (10.5.0)
12
+
13
+ PLATFORMS
14
+ ruby
15
+
16
+ DEPENDENCIES
17
+ bundler (~> 1.16)
18
+ doppler-client!
19
+ hitimes (~> 1.3)
20
+ minitest (~> 5.0)
21
+ rake (~> 10.0)
22
+
23
+ BUNDLED WITH
24
+ 1.16.5
data/README.md CHANGED
@@ -88,6 +88,40 @@ doppler = Doppler::Client.new(
88
88
  ```
89
89
 
90
90
 
91
+ ## Local Key Privacy
92
+
93
+ By default the Doppler client will send all your local environment keys on `init`. This
94
+ is done for 2 reasons. Collecting your local keys helps us automatically setup your pipelines
95
+ for immediate use. After setup we also use your keys to detect when your keys locally have
96
+ changed from what is on Doppler. We then provide a way for you to adopt or reject those changes
97
+ through our dashboard. This can help help when debugging silent bugs or build failures.
98
+
99
+ If you would like the Doppler client to not send your keys we provide 2 ways to do it.
100
+
101
+ ### Globally
102
+ To ensure all your local keys are not sent to Doppler, set the `send_local_keys` attribute to `false`.
103
+
104
+ ``` ruby
105
+ doppler = Doppler::Client.new(
106
+ # ...
107
+ send_local_keys = false # DEFAUTLS => True
108
+ )
109
+ ```
110
+
111
+
112
+ ### Individual Key
113
+ You can also ignore specific local keys by adding them to the `ignore_keys` array.
114
+
115
+ ``` ruby
116
+ doppler = Doppler::Client.new(
117
+ # ...
118
+ ignore_keys: [
119
+ "SUPER_SECRET_KEY"
120
+ ]
121
+ )
122
+ ```
123
+
124
+
91
125
  ## Extra Information
92
126
 
93
127
  - [Doppler](https://doppler.market)
@@ -1,16 +1,16 @@
1
1
  lib = File.expand_path("../lib", __FILE__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require "doppler/client/version"
4
3
 
5
4
  Gem::Specification.new do |spec|
6
5
  spec.name = "doppler-client"
7
- spec.version = Doppler::VERSION
8
- spec.authors = "Doppler Team"
6
+ spec.version = "0.1.1"
7
+ spec.authors = ["Doppler Team"]
9
8
  spec.email = "brian@doppler.market"
10
9
 
11
10
  spec.summary = "The official Doppler Ruby client."
12
11
  spec.description = "Doppler helps you manage your API keys and secrets across all your projects. See https://doppler.market for details."
13
12
  spec.homepage = "https://github.com/DopplerHQ/ruby-client"
13
+ spec.licenses = "Apache-2.0"
14
14
 
15
15
  # Specify which files should be added to the gem when it is released.
16
16
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -1,6 +1,7 @@
1
1
  require "doppler/client/version"
2
2
  require 'net/https'
3
3
  require 'json'
4
+ require 'set'
4
5
 
5
6
  module Doppler
6
7
  class Priority
@@ -21,24 +22,37 @@ module Doppler
21
22
  @@environ_segment = '/environments/'
22
23
  @@max_retries = 0
23
24
 
24
- def initialize(api_key, pipeline, environment, priority = Priority.remote)
25
+ def initialize(api_key, pipeline, environment, priority = Priority.remote, send_local_keys = true, ignore_keys = [])
25
26
  raise ArgumentError, 'api_key not string' unless api_key.is_a? String
26
27
  raise ArgumentError, 'pipeline not string' unless pipeline.is_a? String
27
28
  raise ArgumentError, 'api_key not string' unless environment.is_a? String
28
- raise ArgumentError, 'api_key not numeric' unless priority.is_a? Numeric
29
+ raise ArgumentError, 'priority not numeric' unless priority.is_a? Numeric
29
30
 
30
31
  @api_key = api_key
31
32
  @pipeline = pipeline
32
33
  @environment = environment
33
34
  @default_priority = priority
35
+ @send_local_keys = send_local_keys
36
+ @ignore_keys = ignore_keys.to_set
34
37
  @host = ENV[@@host_key] ? ENV[@@host_key] : @@default_host
35
38
 
36
39
  startup()
37
40
  end
38
41
 
39
42
  def startup
43
+ keys_to_send = {}
44
+ local_keys = ENV.to_hash
45
+
46
+ if @send_local_keys
47
+ local_keys.each do |key, value|
48
+ if not @ignore_keys.include?(key)
49
+ keys_to_send[key] = value
50
+ end
51
+ end
52
+ end
53
+
40
54
  resp = self._request('/fetch_keys', {
41
- 'local_keys' => ENV.to_hash
55
+ 'local_keys' => keys_to_send
42
56
  })
43
57
 
44
58
  @remote_keys = resp['keys']
@@ -54,10 +68,12 @@ module Doppler
54
68
  return @remote_keys[key_name]
55
69
  end
56
70
  end
57
-
58
- _request('/missing_key', {
59
- 'key_name' => key_name
60
- })
71
+
72
+ if not @ignore_keys.include?(key_name)
73
+ _request('/missing_key', {
74
+ 'key_name' => key_name
75
+ })
76
+ end
61
77
 
62
78
  return ENV[key_name]
63
79
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doppler-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doppler Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-25 00:00:00.000000000 Z
11
+ date: 2018-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -76,6 +76,7 @@ files:
76
76
  - ".gitignore"
77
77
  - CODE_OF_CONDUCT.md
78
78
  - Gemfile
79
+ - Gemfile.lock
79
80
  - LICENSE
80
81
  - README.md
81
82
  - Rakefile
@@ -83,9 +84,9 @@ files:
83
84
  - bin/setup
84
85
  - doppler-client.gemspec
85
86
  - lib/doppler/client.rb
86
- - lib/doppler/client/version.rb
87
87
  homepage: https://github.com/DopplerHQ/ruby-client
88
- licenses: []
88
+ licenses:
89
+ - Apache-2.0
89
90
  metadata: {}
90
91
  post_install_message:
91
92
  rdoc_options: []
@@ -1,3 +0,0 @@
1
- module Doppler
2
- VERSION = "0.1.0"
3
- end