multa_arcana 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +32 -2
- data/lib/multa_arcana/multa_arcana.rb +6 -0
- data/lib/multa_arcana/version.rb +1 -1
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -1,2 +1,32 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
= MultiArcana
|
2
|
+
|
3
|
+
Rails applications have many secret strings, and storing them in a public
|
4
|
+
revision control system is a security issue. This gem simplifies secret
|
5
|
+
management by storing all secrets in a single file, which is then copied
|
6
|
+
into place using Capistrano or other deployment tools.
|
7
|
+
|
8
|
+
Usage:
|
9
|
+
|
10
|
+
gem 'multa_arcana'
|
11
|
+
|
12
|
+
Create a file +config/secrets.yml+ to contain your secrets:
|
13
|
+
|
14
|
+
db_username: your-username-here
|
15
|
+
db_password: your-db-password-here
|
16
|
+
secret_token: klsjdklajd...2342342ds9u
|
17
|
+
|
18
|
+
Then, in any place where you normally use a secret, retrieve it:
|
19
|
+
|
20
|
+
+config/initializers/secret_token.rb+
|
21
|
+
Thing::Application.config.secret_token = MultaArcana::secret_for(:secret_token)
|
22
|
+
|
23
|
+
+config/database.yml+
|
24
|
+
|
25
|
+
production:
|
26
|
+
adapter: postgresql
|
27
|
+
encoding: unicode
|
28
|
+
database: thing_production
|
29
|
+
pool: 5
|
30
|
+
host: 127.0.0.1
|
31
|
+
username: <%= MultaArcana::secret_for(:db_username) %>
|
32
|
+
password: <%= MultaArcana::secret_for(:db_password) %>
|
@@ -3,6 +3,12 @@ class MultaArcana
|
|
3
3
|
@@secrets = nil
|
4
4
|
@@secret_file = nil
|
5
5
|
|
6
|
+
#
|
7
|
+
# Load secrets from the default file (+secrets.yml+, or +config/secrets.yml+
|
8
|
+
# for a Rails application) or from the file specified. The file is sticky;
|
9
|
+
# the first call to +secret_for+ sets the file in use, and afterwards all
|
10
|
+
# following secret_for calls use the data from a cache.
|
11
|
+
#
|
6
12
|
def self.secret_for(tag, fname = nil)
|
7
13
|
load_file(fname)
|
8
14
|
@@secrets[tag.to_s]
|
data/lib/multa_arcana/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multa_arcana
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -106,7 +106,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
segments:
|
108
108
|
- 0
|
109
|
-
hash:
|
109
|
+
hash: 93698497967661250
|
110
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
111
|
none: false
|
112
112
|
requirements:
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
version: '0'
|
116
116
|
segments:
|
117
117
|
- 0
|
118
|
-
hash:
|
118
|
+
hash: 93698497967661250
|
119
119
|
requirements: []
|
120
120
|
rubyforge_project:
|
121
121
|
rubygems_version: 1.8.25
|