elasticsearch_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 +6 -0
- data/Dockerfile +23 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +55 -0
- data/LICENSE.txt +21 -0
- data/README.md +59 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docker-compose.yml +79 -0
- data/docker/docker-entrypoint.sh +24 -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/elasticsearch_env_config.gemspec +22 -0
- data/lib/elasticsearch_env_config.rb +24 -0
- data/lib/elasticsearch_env_config/version.rb +3 -0
- metadata +66 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 753bef28e74ace417f826cdd50e9d22cef7e098ad411ec1368d5f9bddcc8485e
|
4
|
+
data.tar.gz: d2937ddca24ef93faed02f04d6822f2dbff493b8ac120c03a02bd56f819fc71a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 460ebc6b4e9ca01f272df06aa123c5fb5548bb99bb922fd945c5997f3779a806ff9fa6724add3b59fc8dccda6891cc1c7d665a022b39821bc9922a8853878c77
|
7
|
+
data.tar.gz: '08c2ac6aea529896ecf620ea413f2694745a797041141445c2a0a740d2011667102b2df10d96c7858bbd7b331daac67dd6d8f9ed3e0a7f759e9fc74e3faa3206'
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Dockerfile
ADDED
@@ -0,0 +1,23 @@
|
|
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 elasticsearch_env_config.gemspec ./
|
12
|
+
ADD lib/elasticsearch_env_config/version.rb ./lib/elasticsearch_env_config/version.rb
|
13
|
+
RUN bundle install --jobs=3 --retry=3
|
14
|
+
ADD . ./
|
15
|
+
|
16
|
+
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
17
|
+
|
18
|
+
ENV RSPEC_ARGS="--force-color -fd"
|
19
|
+
ENV RSPEC_SPECS=spec
|
20
|
+
ENV RSPEC_TAG_ARGS="--tag ~connect"
|
21
|
+
ENV TEST_ES_SERVER=""
|
22
|
+
|
23
|
+
CMD bundle exec rspec ${RSPEC_ARGS} ${RSPEC_TAG_ARGS} ${RSPEC_SPECS}
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
elasticsearch_env_config (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.4.4)
|
10
|
+
elasticsearch (7.12.0)
|
11
|
+
elasticsearch-api (= 7.12.0)
|
12
|
+
elasticsearch-transport (= 7.12.0)
|
13
|
+
elasticsearch-api (7.12.0)
|
14
|
+
multi_json
|
15
|
+
elasticsearch-transport (7.12.0)
|
16
|
+
faraday (~> 1)
|
17
|
+
multi_json
|
18
|
+
faraday (1.4.1)
|
19
|
+
faraday-excon (~> 1.1)
|
20
|
+
faraday-net_http (~> 1.0)
|
21
|
+
faraday-net_http_persistent (~> 1.1)
|
22
|
+
multipart-post (>= 1.2, < 3)
|
23
|
+
ruby2_keywords (>= 0.0.4)
|
24
|
+
faraday-excon (1.1.0)
|
25
|
+
faraday-net_http (1.0.1)
|
26
|
+
faraday-net_http_persistent (1.1.0)
|
27
|
+
multi_json (1.15.0)
|
28
|
+
multipart-post (2.1.1)
|
29
|
+
rake (12.3.3)
|
30
|
+
rspec (3.10.0)
|
31
|
+
rspec-core (~> 3.10.0)
|
32
|
+
rspec-expectations (~> 3.10.0)
|
33
|
+
rspec-mocks (~> 3.10.0)
|
34
|
+
rspec-core (3.10.1)
|
35
|
+
rspec-support (~> 3.10.0)
|
36
|
+
rspec-expectations (3.10.1)
|
37
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
38
|
+
rspec-support (~> 3.10.0)
|
39
|
+
rspec-mocks (3.10.2)
|
40
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
+
rspec-support (~> 3.10.0)
|
42
|
+
rspec-support (3.10.2)
|
43
|
+
ruby2_keywords (0.0.4)
|
44
|
+
|
45
|
+
PLATFORMS
|
46
|
+
ruby
|
47
|
+
|
48
|
+
DEPENDENCIES
|
49
|
+
elasticsearch (~> 7.12)
|
50
|
+
elasticsearch_env_config!
|
51
|
+
rake (~> 12.0)
|
52
|
+
rspec (~> 3.0)
|
53
|
+
|
54
|
+
BUNDLED WITH
|
55
|
+
2.1.4
|
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,59 @@
|
|
1
|
+
# ElasticsearchEnvConfig
|
2
|
+
|
3
|
+
Provides redis client configuration based on environment variables:
|
4
|
+
|
5
|
+
* `ELASTICSEARCH_HOSTS` - comma-separated list of standard elasticsearch hosts understood by the [elasticsearch-transport](https://rubygems.org/gems/elasticsearch-transport) gem.
|
6
|
+
* `ELASTICSEARCH_INDEX` - index to log into, sans date pattern (required)
|
7
|
+
* `ELASTICSEARCH_USER` - username for authenticating against all hosts (required if `ELASTICSEARCH_PASSWORD` is given)
|
8
|
+
* `ELASTICSEARCH_PASSWORD` - password for authenticating against all hosts (required if `ELASTICSEARCH_USER` is given)
|
9
|
+
* `ELASTICSEARCH_DATE_PATTERN` - time format used to generate the full index name
|
10
|
+
* `ELASTICSEARCH_HOST` - name of this host to appear in log messages
|
11
|
+
* `ELASTICSEARCH_APPLICATION` - name of this application to appear in log messages
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'elasticsearch_env_config'
|
19
|
+
```
|
20
|
+
|
21
|
+
And then execute:
|
22
|
+
|
23
|
+
$ bundle install
|
24
|
+
|
25
|
+
Or install it yourself as:
|
26
|
+
|
27
|
+
$ gem install elasticsearch_env_config
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
```
|
32
|
+
require "redis"
|
33
|
+
require "elasticsearch"
|
34
|
+
require "semantic_logger"
|
35
|
+
|
36
|
+
SemanticLogger.add_appender(appender: :elasticsearch, **(ElasticSearchEnvConfig.new.to_h))
|
37
|
+
```
|
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
|
+
For development without docker-compose, you can skip examples that connect to elasticsearch with:
|
47
|
+
|
48
|
+
```
|
49
|
+
ELASTICSEARCH_HOSTS=fake bundle exec rspec -fd --tag ~connect spec
|
50
|
+
```
|
51
|
+
|
52
|
+
## Contributing
|
53
|
+
|
54
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/webnifico/elasticsearch_env_config.
|
55
|
+
|
56
|
+
|
57
|
+
## License
|
58
|
+
|
59
|
+
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 "elasticsearch_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,79 @@
|
|
1
|
+
version: "3"
|
2
|
+
|
3
|
+
services:
|
4
|
+
test:
|
5
|
+
build:
|
6
|
+
context: .
|
7
|
+
environment:
|
8
|
+
RSPEC_TAG_ARGS: "--tag ~connect:@connect"
|
9
|
+
TEST_ES_SERVER: es01:9200
|
10
|
+
ELASTICSEARCH_HOSTS: es01:9200, es02:9200, es03:9200
|
11
|
+
depends_on:
|
12
|
+
- es01
|
13
|
+
- es02
|
14
|
+
- es03
|
15
|
+
es01:
|
16
|
+
image: docker.elastic.co/elasticsearch/elasticsearch:7.12.0
|
17
|
+
container_name: es01
|
18
|
+
environment:
|
19
|
+
- node.name=es01
|
20
|
+
- cluster.name=es-docker-cluster
|
21
|
+
- discovery.seed_hosts=es02,es03
|
22
|
+
- cluster.initial_master_nodes=es01,es02,es03
|
23
|
+
- bootstrap.memory_lock=true
|
24
|
+
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
25
|
+
ulimits:
|
26
|
+
memlock:
|
27
|
+
soft: -1
|
28
|
+
hard: -1
|
29
|
+
volumes:
|
30
|
+
- data01:/usr/share/elasticsearch/data
|
31
|
+
ports:
|
32
|
+
- 9200
|
33
|
+
- 9300
|
34
|
+
es02:
|
35
|
+
image: docker.elastic.co/elasticsearch/elasticsearch:7.12.0
|
36
|
+
container_name: es02
|
37
|
+
environment:
|
38
|
+
- node.name=es02
|
39
|
+
- cluster.name=es-docker-cluster
|
40
|
+
- discovery.seed_hosts=es01,es03
|
41
|
+
- cluster.initial_master_nodes=es01,es02,es03
|
42
|
+
- bootstrap.memory_lock=true
|
43
|
+
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
44
|
+
ulimits:
|
45
|
+
memlock:
|
46
|
+
soft: -1
|
47
|
+
hard: -1
|
48
|
+
volumes:
|
49
|
+
- data02:/usr/share/elasticsearch/data
|
50
|
+
ports:
|
51
|
+
- 9200
|
52
|
+
- 9300
|
53
|
+
es03:
|
54
|
+
image: docker.elastic.co/elasticsearch/elasticsearch:7.12.0
|
55
|
+
container_name: es03
|
56
|
+
environment:
|
57
|
+
- node.name=es03
|
58
|
+
- cluster.name=es-docker-cluster
|
59
|
+
- discovery.seed_hosts=es01,es02
|
60
|
+
- cluster.initial_master_nodes=es01,es02,es03
|
61
|
+
- bootstrap.memory_lock=true
|
62
|
+
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
63
|
+
ulimits:
|
64
|
+
memlock:
|
65
|
+
soft: -1
|
66
|
+
hard: -1
|
67
|
+
volumes:
|
68
|
+
- data03:/usr/share/elasticsearch/data
|
69
|
+
ports:
|
70
|
+
- 9200
|
71
|
+
- 9300
|
72
|
+
|
73
|
+
volumes:
|
74
|
+
data01:
|
75
|
+
driver: local
|
76
|
+
data02:
|
77
|
+
driver: local
|
78
|
+
data03:
|
79
|
+
driver: local
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
TEST_ES_SERVER=${TEST_ES_SERVER:-"http://localhost:9200"}
|
4
|
+
echo $TEST_ES_SERVER
|
5
|
+
attempt_counter=0
|
6
|
+
max_attempts=20
|
7
|
+
url="${TEST_ES_SERVER}/_cluster/health?wait_for_status=green&timeout=50s"
|
8
|
+
|
9
|
+
echo "Waiting for Elasticsearch..."
|
10
|
+
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' --max-time 55 "$url")" != "200" ]]; do
|
11
|
+
if [ ${attempt_counter} -eq ${max_attempts} ];then
|
12
|
+
echo
|
13
|
+
echo "Couldn't connect to Elasticsearch"
|
14
|
+
exit 1
|
15
|
+
fi
|
16
|
+
|
17
|
+
attempt_counter=$(($attempt_counter+1))
|
18
|
+
sleep 5
|
19
|
+
done
|
20
|
+
|
21
|
+
echo
|
22
|
+
echo "Ready"
|
23
|
+
|
24
|
+
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
|
+
BP0DR2Su9TK2AczRXWcvhk0SHmtecrCeLy3CK01ko7ybJWGUUKMOWxVw/FQCkfUl
|
10
|
+
qYOkD5HOg77n5AylVPkkxs5ea9Kk2HHLZlfE2+1M0v/Iu/JGc6SkgFPVj4kx+Tbn
|
11
|
+
QHla7tgBNwJeB920cCMJ9ZpxoxZuk8DGDTGWOl6xpxYrzEjo3n7PQ6evIsvTMwKd
|
12
|
+
6cTnR2Fo6FkOUPRhtSwj44/Z3HZT1BKzswopRXEQHC89FnnFVeSYpyOZEK80o+uu
|
13
|
+
YL7PO1QhAo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5roG7ZMR+JZ82H0RCK1Kn1bAFVzoDuBXgtuzYgo3WhReRllc
|
26
|
+
ljOBIcFS3L2Jav3uT2NuB4/L6jYIu6QddIn3ToGuDaVT5fzKne3MODQ=
|
27
|
+
-----END RSA PRIVATE KEY-----
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative 'lib/elasticsearch_env_config/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "elasticsearch_env_config"
|
5
|
+
spec.version = ElasticsearchEnvConfig::VERSION
|
6
|
+
spec.authors = ["Sheldon Hearn"]
|
7
|
+
spec.email = ["sheldonh@starjuice.net"]
|
8
|
+
|
9
|
+
spec.summary = %q{Elasticsearch client configuration from environment}
|
10
|
+
spec.description = %q{Provides elasticsearch client configuration from environment variables}
|
11
|
+
spec.homepage = "https://github.com/webnifico/elasticsearch_env_config"
|
12
|
+
spec.license = "MIT"
|
13
|
+
|
14
|
+
# Specify which files should be added to the gem when it is released.
|
15
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
16
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
17
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require "elasticsearch_env_config/version"
|
2
|
+
|
3
|
+
class ElasticsearchEnvConfig
|
4
|
+
class Error < StandardError; end
|
5
|
+
|
6
|
+
def initialize(env: ENV)
|
7
|
+
@env = env
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_h
|
11
|
+
{}.tap do |config|
|
12
|
+
if @env.include?("ELASTICSEARCH_HOSTS")
|
13
|
+
config[:hosts] = @env.fetch("ELASTICSEARCH_HOSTS").split(/[,\s]+/)
|
14
|
+
config[:index] = @env.fetch("ELASTICSEARCH_INDEX") { raise Error, "missing environment variable ELASTICSEARCH_INDEX" }
|
15
|
+
|
16
|
+
%i[ user password date_pattern host application ].each do |key|
|
17
|
+
v = @env["ELASTICSEARCH_#{key.upcase}"]
|
18
|
+
config[key] = v if v
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: elasticsearch_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-05-12 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Provides elasticsearch client configuration from environment variables
|
14
|
+
email:
|
15
|
+
- sheldonh@starjuice.net
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".gitignore"
|
21
|
+
- ".rspec"
|
22
|
+
- ".travis.yml"
|
23
|
+
- Dockerfile
|
24
|
+
- Gemfile
|
25
|
+
- Gemfile.lock
|
26
|
+
- LICENSE.txt
|
27
|
+
- README.md
|
28
|
+
- Rakefile
|
29
|
+
- bin/console
|
30
|
+
- bin/setup
|
31
|
+
- docker-compose.yml
|
32
|
+
- docker/docker-entrypoint.sh
|
33
|
+
- docker/minica/README
|
34
|
+
- docker/minica/minica-key.pem
|
35
|
+
- docker/minica/minica.pem
|
36
|
+
- docker/minica/redis-client/cert.pem
|
37
|
+
- docker/minica/redis-client/key.pem
|
38
|
+
- docker/minica/redis-ssl/cert.pem
|
39
|
+
- docker/minica/redis-ssl/key.pem
|
40
|
+
- elasticsearch_env_config.gemspec
|
41
|
+
- lib/elasticsearch_env_config.rb
|
42
|
+
- lib/elasticsearch_env_config/version.rb
|
43
|
+
homepage: https://github.com/webnifico/elasticsearch_env_config
|
44
|
+
licenses:
|
45
|
+
- MIT
|
46
|
+
metadata: {}
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
requirements: []
|
62
|
+
rubygems_version: 3.1.6
|
63
|
+
signing_key:
|
64
|
+
specification_version: 4
|
65
|
+
summary: Elasticsearch client configuration from environment
|
66
|
+
test_files: []
|