rcredstash 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/README.md +20 -6
- data/lib/cred_stash/config.rb +23 -0
- data/lib/cred_stash/repository.rb +4 -4
- data/lib/cred_stash/version.rb +1 -1
- data/lib/cred_stash.rb +1 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01346a89bdc206884178c9b88a70383b487614a7
|
4
|
+
data.tar.gz: 5c0a22d91b59d25bbc7bce6b5845638c204f845b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a58c364392fa4b35a78f6ce4fd71bee33e81ba3a5dfa812b45fe726e1f67df44e1f9937213cfa19fa6e8da49094edbe677da988e1f2f5273f0061ec9de225ff9
|
7
|
+
data.tar.gz: 6b7f4c0eaf091342ab0ddbe29c98ea149f995a7af13590ba781d21cc9801ce8b4ff1a29d6339858d6af79702f0882d51fb95965f875b6c06d5e40d395ff1bd09
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# RCredStash [![Build Status](https://travis-ci.org/adorechic/rcredstash.svg?branch=master)](https://travis-ci.org/adorechic/rcredstash)
|
2
2
|
|
3
|
-
|
3
|
+
RCredStash is a ruby port of [CredStash](https://github.com/fugue/credstash)
|
4
4
|
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
5
|
|
7
6
|
## Installation
|
8
7
|
|
@@ -22,7 +21,23 @@ Or install it yourself as:
|
|
22
21
|
|
23
22
|
## Usage
|
24
23
|
|
25
|
-
|
24
|
+
```ruby
|
25
|
+
CredStash.get(key)
|
26
|
+
CredStash.put(key, value)
|
27
|
+
CredStash.list
|
28
|
+
CredStash.delete(key)
|
29
|
+
```
|
30
|
+
|
31
|
+
### AWS credentials
|
32
|
+
RCredStash uses [aws-sdk v2](https://github.com/aws/aws-sdk-ruby), so configuration options provided by aws-sdk such as `ENV['AWS_ACCESS_KEY_ID']` and `ENV['AWS_SECRET_ACCESS_KEY']` are available.
|
33
|
+
|
34
|
+
### Configurations
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
CredStash.configure do |config|
|
38
|
+
config.table_name = 'your_dynamodb_table_name'
|
39
|
+
end
|
40
|
+
```
|
26
41
|
|
27
42
|
## Development
|
28
43
|
|
@@ -32,10 +47,9 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
47
|
|
33
48
|
## Contributing
|
34
49
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
50
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/adorechic/rcredstash.
|
36
51
|
|
37
52
|
|
38
53
|
## License
|
39
54
|
|
40
55
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
-
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module CredStash
|
2
|
+
class << self
|
3
|
+
def configure
|
4
|
+
yield config
|
5
|
+
end
|
6
|
+
|
7
|
+
def config
|
8
|
+
@config ||= Config.new
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class Config
|
13
|
+
attr_accessor :table_name
|
14
|
+
|
15
|
+
def initialize
|
16
|
+
reset!
|
17
|
+
end
|
18
|
+
|
19
|
+
def reset!
|
20
|
+
@table_name = 'credential-store'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -26,7 +26,7 @@ class CredStash::Repository
|
|
26
26
|
|
27
27
|
def select(name, pluck: nil, limit: nil)
|
28
28
|
params = {
|
29
|
-
table_name:
|
29
|
+
table_name: CredStash.config.table_name,
|
30
30
|
consistent_read: true,
|
31
31
|
key_condition_expression: "#name = :name",
|
32
32
|
expression_attribute_names: { "#name" => "name"},
|
@@ -54,7 +54,7 @@ class CredStash::Repository
|
|
54
54
|
|
55
55
|
def put(item)
|
56
56
|
@client.put_item(
|
57
|
-
table_name:
|
57
|
+
table_name: CredStash.config.table_name,
|
58
58
|
item: {
|
59
59
|
name: item.name,
|
60
60
|
version: item.version,
|
@@ -69,7 +69,7 @@ class CredStash::Repository
|
|
69
69
|
|
70
70
|
def list
|
71
71
|
@client.scan(
|
72
|
-
table_name:
|
72
|
+
table_name: CredStash.config.table_name,
|
73
73
|
projection_expression: '#name, version',
|
74
74
|
expression_attribute_names: { "#name" => "name" },
|
75
75
|
).items.map do |item|
|
@@ -79,7 +79,7 @@ class CredStash::Repository
|
|
79
79
|
|
80
80
|
def delete(item)
|
81
81
|
@client.delete_item(
|
82
|
-
table_name:
|
82
|
+
table_name: CredStash.config.table_name,
|
83
83
|
key: {
|
84
84
|
name: item.name,
|
85
85
|
version: item.version
|
data/lib/cred_stash/version.rb
CHANGED
data/lib/cred_stash.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rcredstash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- adorechic
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- lib/cred_stash.rb
|
87
87
|
- lib/cred_stash/cipher.rb
|
88
88
|
- lib/cred_stash/cipher_key.rb
|
89
|
+
- lib/cred_stash/config.rb
|
89
90
|
- lib/cred_stash/error.rb
|
90
91
|
- lib/cred_stash/repository.rb
|
91
92
|
- lib/cred_stash/secret.rb
|
@@ -112,8 +113,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
113
|
version: '0'
|
113
114
|
requirements: []
|
114
115
|
rubyforge_project:
|
115
|
-
rubygems_version: 2.
|
116
|
+
rubygems_version: 2.5.2
|
116
117
|
signing_key:
|
117
118
|
specification_version: 4
|
118
119
|
summary: A Ruby port of CredStash
|
119
120
|
test_files: []
|
121
|
+
has_rdoc:
|