redis_env_config 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Dockerfile +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +52 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docker-compose.yml +22 -0
- data/docker/docker-entrypoint.sh +17 -0
- data/docker/minica/README +13 -0
- data/docker/minica/minica-key.pem +27 -0
- data/docker/minica/minica.pem +19 -0
- data/docker/minica/redis-client/cert.pem +19 -0
- data/docker/minica/redis-client/key.pem +27 -0
- data/docker/minica/redis-ssl/cert.pem +19 -0
- data/docker/minica/redis-ssl/key.pem +27 -0
- data/lib/redis_env_config.rb +28 -0
- data/lib/redis_env_config/version.rb +3 -0
- data/redis_env_config.gemspec +30 -0
- metadata +122 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9207ea50f1e51550994fbce131e0e8d2b23a34e67777e9797200fbc9cbe9c5fe
|
4
|
+
data.tar.gz: c9140f9073d744f0750613a7c2788975de8cca13f3e0fdcf8e56349826b94186
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6e73270db120ed2b5baf4d13bbdd9409ca9bb3339245661959ad1465a3f662f987ab370569a2b1b3c269d51b55e62763b8f34356b4dcc3d3f0ae5306b871b0f5
|
7
|
+
data.tar.gz: ee41787321de137d97a323a7f5deae525e3fe0bddd69429be618fc6acbb675b065d773e218e1b05945e44bccbf85627345840ad4ea2c8c6bc76471be09952389
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Dockerfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
FROM ruby:2.5
|
2
|
+
|
3
|
+
RUN gem install --no-doc bundler
|
4
|
+
|
5
|
+
RUN mkdir /usr/src/app
|
6
|
+
|
7
|
+
WORKDIR /usr/local/src
|
8
|
+
|
9
|
+
ADD docker/docker-entrypoint.sh /
|
10
|
+
ADD docker/minica ./minica
|
11
|
+
ADD Gemfile redis_env_config.gemspec ./
|
12
|
+
ADD lib/redis_env_config/version.rb ./lib/redis_env_config/version.rb
|
13
|
+
RUN bundle install --jobs=3 --retry=3
|
14
|
+
ADD . ./
|
15
|
+
|
16
|
+
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
17
|
+
|
18
|
+
CMD bundle exec rspec --force-color -fd spec
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Sheldon Hearn
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# RedisEnvConfig
|
2
|
+
|
3
|
+
Provides redis client configuration based on environment variables:
|
4
|
+
|
5
|
+
* `REDIS_URL` - standard Redis URL understood by the [redis](https://rubygems.org/gems/redis) gem.
|
6
|
+
* `REDIS_CERT` - PEM-encoded client certificate with which to connect to redis
|
7
|
+
(required if `REDIS_URL` begins with `rediss:`)
|
8
|
+
* `REDIS_KEY` - PEM-encoded client key with which to connect to redis
|
9
|
+
(required if `REDIS_URL` begins with `rediss:`)
|
10
|
+
* `REDIS_CA_FILE` - Path to file containing PEM-encoded CA certificate with which to validate server certificate
|
11
|
+
(required if `REDIS_URL` begins with `rediss:`)
|
12
|
+
* `REDIS_CA` - PEM-encoded CA certificate with which to validate server certificate
|
13
|
+
(if present, content is written to `REDIS_CA_FILE`, if that file does not yet exist)
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
Add this line to your application's Gemfile:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
gem 'redis_env_config'
|
21
|
+
```
|
22
|
+
|
23
|
+
And then execute:
|
24
|
+
|
25
|
+
$ bundle
|
26
|
+
|
27
|
+
Or install it yourself as:
|
28
|
+
|
29
|
+
$ gem install redis_env_config
|
30
|
+
|
31
|
+
## Usage
|
32
|
+
|
33
|
+
```
|
34
|
+
require "redis"
|
35
|
+
require "redis_env_config"
|
36
|
+
|
37
|
+
redis = Redis.new(RedisEnvConfig.new.to_h)
|
38
|
+
```
|
39
|
+
|
40
|
+
## Development
|
41
|
+
|
42
|
+
After checking out the repo, run `docker-compose build && docker-compose run test` to run the tests.
|
43
|
+
|
44
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
45
|
+
|
46
|
+
## Contributing
|
47
|
+
|
48
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/webnifico/redis_env_config.
|
49
|
+
|
50
|
+
## License
|
51
|
+
|
52
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "redis_env_config"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/docker-compose.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
version: "3"
|
2
|
+
|
3
|
+
services:
|
4
|
+
redis:
|
5
|
+
image: redis:6.2.1
|
6
|
+
volumes:
|
7
|
+
- "./docker/minica:/usr/src"
|
8
|
+
redis-ssl:
|
9
|
+
image: redis:6.2.1
|
10
|
+
command: >
|
11
|
+
redis-server --tls-port 6379 --port 0
|
12
|
+
--tls-cert-file /usr/src/redis-ssl/cert.pem
|
13
|
+
--tls-key-file /usr/src/redis-ssl/key.pem
|
14
|
+
--tls-ca-cert-file /usr/src/minica.pem
|
15
|
+
volumes:
|
16
|
+
- "./docker/minica:/usr/src"
|
17
|
+
test:
|
18
|
+
build:
|
19
|
+
context: .
|
20
|
+
depends_on:
|
21
|
+
- redis
|
22
|
+
- redis-ssl
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
waitfor() {
|
4
|
+
host=$1
|
5
|
+
port=$2
|
6
|
+
|
7
|
+
echo Waiting for tcp://$host:$port... 1>&2
|
8
|
+
while ! echo > /dev/tcp/$host/$port; do
|
9
|
+
echo Waiting for tcp://$host:$port... 1>&2
|
10
|
+
sleep 1
|
11
|
+
done 2>/dev/null
|
12
|
+
}
|
13
|
+
|
14
|
+
waitfor redis 6379
|
15
|
+
waitfor redis-ssl 6379
|
16
|
+
|
17
|
+
exec "$@"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
redis-server --tls-port 6379 --port 0 \
|
2
|
+
--tls-cert-file redis-server/cert.pem --tls-key-file redis-server/key.pem --tls-ca-cert-file minica.pem
|
3
|
+
redis-cli -h redis --tls \
|
4
|
+
--cert redis-client/cert.pem --key redis-client/key.pem --cacert minica.pem
|
5
|
+
|
6
|
+
redis = Redis.new(
|
7
|
+
url: "rediss://redis:6379/1",
|
8
|
+
ssl_params: {
|
9
|
+
cert: OpenSSL::X509::Certificate.new(File.read("redis-client/cert.pem")),
|
10
|
+
key: OpenSSL::PKey::RSA.new(File.read("redis-client/key.pem")),
|
11
|
+
ca_file: "./minica.pem"
|
12
|
+
}
|
13
|
+
)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
-----BEGIN RSA PRIVATE KEY-----
|
2
|
+
MIIEpQIBAAKCAQEApD4TG5+75/JlDdFOSRYUmfqcZJq4XqKeR2NXQbFVBhBg3Cb1
|
3
|
+
DEnXEGLJs5UtTcDSRxxJTkCHTfa6KXEqR3VvSk5SFHdS1XOCJvPnNOt0eWgsizsG
|
4
|
+
KS2Joq5pu92vsfEgjxTC1i+K/6htPoIMcIWBa7WjbcRvN0LkG9iYFx8PWLJR0NSF
|
5
|
+
fzFDGiiixMSH9OLiGQBCx6Iz/MeGfzHv7nYe8JiMADnS9pjCsAoRBIRt1Q/ke5CE
|
6
|
+
Lx5hw85X9wt6uoXFSxUMEMXekvkgtXMaC7mkOKCE1+/WAZjUCgX1uaf/P8QMTViS
|
7
|
+
0zlhqWiVL2wVkKbvOePybAjMCOzIUR7erAv/GwIDAQABAoIBAQCSWK12A9LPTnE0
|
8
|
+
6rey7/XTbjdEfYii6ovWWHI7muODz7w+7oeTN4hmlV/coKQJkDLOIio/i8gEdEBV
|
9
|
+
BP0DR2Su9TK2AczRXWcvhk0SHmtecrCeLy3CK01ko7ybJWGUUKMOW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
22
|
+
zLhSak8DAOZt272ku7HcG6qrrUrj0Dz4rMDRSYL32OfF79nGAA6b6jc2CWBqs2Ou
|
23
|
+
enBJ8iYxks/xsP4clY94PhrSTHIdM/f6m9dS8gm7Ii53RFBxzlmxES1TdgF+wBcY
|
24
|
+
pN0qzRkCgYAuDAGKfUwpjdzNWawJy6NLeG7+HnniIpxs2Jlyt7RjyOYY5eM8UnrF
|
25
|
+
K2JEKZGLKXuyNgk0UBSHE3p1zoO7qihLOYgaHfzMXSZQCMPkBl8m331HLz0qOKqW
|
26
|
+
KQ2vgWLk5cF+ndq6FWxv+qbjd7ukXhcWs3hTwihN1HUU1Yxc4OFr9A==
|
27
|
+
-----END RSA PRIVATE KEY-----
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require "redis_env_config/version"
|
2
|
+
require "redis"
|
3
|
+
|
4
|
+
class RedisEnvConfig
|
5
|
+
class Error < StandardError; end
|
6
|
+
|
7
|
+
def initialize(env: ENV)
|
8
|
+
@config = {}
|
9
|
+
@config[:url] = env["REDIS_URL"] if env["REDIS_URL"]
|
10
|
+
if !@config[:url].nil? and @config[:url].start_with?("rediss:")
|
11
|
+
@config[:ssl_params] = Hash.new.tap do |x|
|
12
|
+
cert = env["REDIS_CERT"] or raise Error, "missing environment variable REDIS_CERT"
|
13
|
+
x[:cert] = OpenSSL::X509::Certificate.new(cert)
|
14
|
+
key = env["REDIS_KEY"] or raise Error, "missing environment variable REDIS_KEY"
|
15
|
+
x[:key] = OpenSSL::PKey::RSA.new(key)
|
16
|
+
x[:ca_file] = env["REDIS_CA_FILE"] or raise Error, "missing environment variable REDIS_CA_FILE"
|
17
|
+
if env["REDIS_CA"] and !File.exist?(x[:ca_file])
|
18
|
+
File.open(x[:ca_file], "w") { |io| io.write(env["REDIS_CA"]) }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_h
|
25
|
+
@config.dup
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "redis_env_config/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "redis_env_config"
|
8
|
+
spec.version = RedisEnvConfig::VERSION
|
9
|
+
spec.authors = ["Sheldon Hearn"]
|
10
|
+
spec.email = ["sheldonh@starjuice.net"]
|
11
|
+
|
12
|
+
spec.summary = %q{Redis client configuration from environment}
|
13
|
+
spec.description = %q{Provides redis client configuration from environment variables}
|
14
|
+
spec.homepage = "https://github.com/webnifico/redis_env_config"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
end
|
22
|
+
spec.bindir = "exe"
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
spec.add_development_dependency "redis", "~> 4.2"
|
29
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: redis_env_config
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sheldon Hearn
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-04-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: redis
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '4.2'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '4.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
description: Provides redis client configuration from environment variables
|
70
|
+
email:
|
71
|
+
- sheldonh@starjuice.net
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".travis.yml"
|
79
|
+
- Dockerfile
|
80
|
+
- Gemfile
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- bin/console
|
85
|
+
- bin/setup
|
86
|
+
- docker-compose.yml
|
87
|
+
- docker/docker-entrypoint.sh
|
88
|
+
- docker/minica/README
|
89
|
+
- docker/minica/minica-key.pem
|
90
|
+
- docker/minica/minica.pem
|
91
|
+
- docker/minica/redis-client/cert.pem
|
92
|
+
- docker/minica/redis-client/key.pem
|
93
|
+
- docker/minica/redis-ssl/cert.pem
|
94
|
+
- docker/minica/redis-ssl/key.pem
|
95
|
+
- lib/redis_env_config.rb
|
96
|
+
- lib/redis_env_config/version.rb
|
97
|
+
- redis_env_config.gemspec
|
98
|
+
homepage: https://github.com/webnifico/redis_env_config
|
99
|
+
licenses:
|
100
|
+
- MIT
|
101
|
+
metadata: {}
|
102
|
+
post_install_message:
|
103
|
+
rdoc_options: []
|
104
|
+
require_paths:
|
105
|
+
- lib
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
requirements: []
|
117
|
+
rubyforge_project:
|
118
|
+
rubygems_version: 2.7.6
|
119
|
+
signing_key:
|
120
|
+
specification_version: 4
|
121
|
+
summary: Redis client configuration from environment
|
122
|
+
test_files: []
|