ez-credentials 0.1.01 → 0.1.2
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/Gemfile.lock +1 -1
- data/README.md +20 -10
- data/lib/credentials/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efe3550c56924e93ff82abcdac3314ae8297aa10d4028f9ced18fa3598f4fff9
|
4
|
+
data.tar.gz: bef69d939b782aa8011d9930bbeff1b2cae2ae3d5c2d8d086d2b335ffb162e2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84df42e272f9468c62bdf4adfcd2047d9a9a90a071e34eb64d1d039d9bd08c68f38b29f2fbe7d88a081f8948306f50e3e3d66c9231ec65d91ea073a0a945eb41
|
7
|
+
data.tar.gz: 6c63b54e92cb301cddca23ab055b0960d80ebeee53407f50f254ab9b863c9482b2ba4cfc98c5223eacdbee0e6a6e41d5fd23046ccc312545967c701e29cb6864
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,15 +1,12 @@
|
|
1
1
|
# Credentials
|
2
|
-
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/credentials`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
2
|
+
A simple environment-aware wrapper around Rails encrypted credentials.
|
6
3
|
|
7
4
|
## Installation
|
8
5
|
|
9
6
|
Add this line to your application's Gemfile:
|
10
7
|
|
11
8
|
```ruby
|
12
|
-
gem 'credentials'
|
9
|
+
gem 'ez-credentials', require 'credentials'
|
13
10
|
```
|
14
11
|
|
15
12
|
And then execute:
|
@@ -18,7 +15,7 @@ And then execute:
|
|
18
15
|
|
19
16
|
Or install it yourself as:
|
20
17
|
|
21
|
-
$ gem install credentials
|
18
|
+
$ gem install ez-credentials
|
22
19
|
|
23
20
|
## Usage
|
24
21
|
This gem assumes you are in a rails application and are using one encrypted credential file with environmnet namespaces, like the example below:
|
@@ -38,10 +35,23 @@ production:
|
|
38
35
|
bar: realsecret
|
39
36
|
```
|
40
37
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
38
|
+
The `Credentials` class wraps `Rails.application.credentials` call with environment-aware easy accessors.
|
39
|
+
To access credentials in the project for the correct environment, use one of the methods below:
|
40
|
+
```ruby
|
41
|
+
require 'credentials' # if not required in Gemfile
|
42
|
+
|
43
|
+
Credentials.all
|
44
|
+
# => {:foo => {:bar => 'baz'}}
|
45
|
+
|
46
|
+
Credentials.get(:foo) # also takes string 'foo'
|
47
|
+
# => {:bar=>"baz"}
|
48
|
+
|
49
|
+
Credentials.get('foo.bar')
|
50
|
+
# => "baz"
|
51
|
+
|
52
|
+
Credentials.get(:foo, :bar)
|
53
|
+
# => "baz"
|
54
|
+
```
|
45
55
|
|
46
56
|
---
|
47
57
|
|
data/lib/credentials/version.rb
CHANGED