secret_garden 0.0.2 → 0.0.3

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: 58535c85003f25bec878fb5bf9608a9bd3417450
4
- data.tar.gz: 085ce3fc9da6b7d43d92fa077bfe1af540613288
3
+ metadata.gz: 5fd8b035c1e983a5197765165fbfa569c6d5afc8
4
+ data.tar.gz: 8324c7d980b1e747c8ae95e6a4b316bcdaba0f25
5
5
  SHA512:
6
- metadata.gz: bf3e99050f887e486f5650d1faf40b348625cd970da2d85ab5fe4fb00b0243ec399578154a8181f681d87a0326205116410dd4a7742c90feb40147b9116d9518
7
- data.tar.gz: bb554d0653573326a07d69c75cce17d8647eac03cfde6280e90041f6829ca5db6439f6f77e16cbeee92577f03b3781d8f4cacfb653c1eeee382a26ffef93f1fd
6
+ metadata.gz: c4d29092775b47efd8ae2da86793b5b9bc932fffa375ccc846a4d262e9e8dd1036173da8b36e6606bde6fc7be3da4d712ab90d3a4b8c179aff44eeb545eaddb7
7
+ data.tar.gz: 19d7393bc1eec088cd1dce7cfcb2f22b8f2be6bdfc49b3871182d4a5273e62d2f93819340d52cdc60252ec2f0f51a3e49bb428d751ae4ec5e161a19051f38a50
data/README.md CHANGED
@@ -51,6 +51,29 @@ SecretGarden.add_backend :vault
51
51
  s3 = AWS::S3.new access_key_id: SecretGarden.fetch('AWS_ACCESS_KEY_ID')
52
52
  ```
53
53
 
54
+ ### In Rails
55
+
56
+ Your app may need certain environment variables that should fall back to being
57
+ read from vault if not set, such as DATABASE_URL. Simply modify
58
+ config/application.rb to pre-load them:
59
+
60
+ ``` ruby
61
+ # config/application.rb
62
+ require File.expand_path('../boot', __FILE__)
63
+ require File.expand_path('../preinitialize', __FILE__)
64
+
65
+ require "rails"
66
+ # etc ...
67
+ ```
68
+
69
+ ``` ruby
70
+ # config/preinitialize.rb
71
+ require 'secret_garden'
72
+ require 'vault'
73
+
74
+ SecretGarden.export 'DATABASE_URL'
75
+ ```
76
+
54
77
  ## Development
55
78
 
56
79
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -1,3 +1,3 @@
1
1
  module SecretGarden
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/secret_garden.rb CHANGED
@@ -32,6 +32,10 @@ module SecretGarden
32
32
  end
33
33
  end
34
34
 
35
+ def self.expose(name)
36
+ ENV[name] ||= fetch!(name)
37
+ end
38
+
35
39
  def self.map
36
40
  @map ||= SecretGarden::Map.new root: secret_file_path, env: env
37
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: secret_garden
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derek Kastner
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-09 00:00:00.000000000 Z
11
+ date: 2016-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler