dynenv 0.0.0.pre
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 +7 -0
- checksums.yaml.gz.sig +1 -0
- data.tar.gz.sig +0 -0
- data/.codeclimate.yml +8 -0
- data/.gitignore +9 -0
- data/.pryrc +9 -0
- data/.rspec +2 -0
- data/.rubocop.yml +25 -0
- data/.simplecov +16 -0
- data/.travis.yml +18 -0
- data/.yardopts +17 -0
- data/CHANGELOG.md +7 -0
- data/CODE_OF_CONDUCT.md +32 -0
- data/CONTRIBUTING.md +137 -0
- data/Gemfile +44 -0
- data/LICENSE.txt +21 -0
- data/README.md +126 -0
- data/Rakefile +27 -0
- data/SECURITY.md +141 -0
- data/docs/images/.keep +0 -0
- data/dynenv.gemspec +34 -0
- data/exe/dynenv +6 -0
- data/lib/dynenv.rb +31 -0
- data/lib/dynenv/cli.rb +9 -0
- data/lib/dynenv/cli/application.rb +11 -0
- data/lib/dynenv/cli/errors.rb +9 -0
- data/lib/dynenv/configuration.rb +15 -0
- data/lib/dynenv/errors.rb +4 -0
- data/lib/dynenv/instrumentation.rb +5 -0
- data/lib/dynenv/logging.rb +41 -0
- data/lib/dynenv/metrics.rb +5 -0
- data/lib/dynenv/rails-now.rb +2 -0
- data/lib/dynenv/rails.rb +31 -0
- data/lib/dynenv/rake_task.rb +5 -0
- data/lib/dynenv/utilities.rb +5 -0
- data/lib/dynenv/version.rb +11 -0
- data/man/dynenv-config.1.ronn +22 -0
- data/man/dynenv-env.1.ronn +22 -0
- data/man/dynenv-help.1.ronn +22 -0
- data/man/dynenv-init.1.ronn +22 -0
- data/man/dynenv-policy.1.ronn +22 -0
- data/man/dynenv-run.1.ronn +22 -0
- data/man/dynenv-terminate.1.ronn +22 -0
- data/man/dynenv-version.1.ronn +13 -0
- data/man/dynenv.1.ronn +148 -0
- data/man/index.txt +9 -0
- data/tonyhburns.asc +445 -0
- data/tonyhburns.pem +21 -0
- metadata +184 -0
- metadata.gz.sig +0 -0
data/Rakefile
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require File.expand_path('../test_app/config/application', __FILE__)
|
|
2
|
+
Rails.application.load_tasks
|
|
3
|
+
|
|
4
|
+
require 'bundler/gem_tasks'
|
|
5
|
+
require 'inch/rake'
|
|
6
|
+
require 'rspec/core/rake_task'
|
|
7
|
+
require 'rubocop/rake_task'
|
|
8
|
+
require 'yard/rake/yardoc_task'
|
|
9
|
+
|
|
10
|
+
namespace :lint do
|
|
11
|
+
desc 'Lint inline documentation'
|
|
12
|
+
Inch::Rake::Suggest.new(:docs)
|
|
13
|
+
|
|
14
|
+
desc 'Lint Ruby code'
|
|
15
|
+
RuboCop::RakeTask.new(:ruby)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
task lint: %w(lint:docs lint:ruby)
|
|
19
|
+
|
|
20
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
21
|
+
|
|
22
|
+
desc 'Generate API documentation'
|
|
23
|
+
YARD::Rake::YardocTask.new
|
|
24
|
+
|
|
25
|
+
task ci: %w(lint spec)
|
|
26
|
+
|
|
27
|
+
task default: %w(lint spec)
|
data/SECURITY.md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Dynenv Security Policy
|
|
2
|
+
|
|
3
|
+
The authors of Dynenv take web security very seriously. If you've found a
|
|
4
|
+
vulnerability in dynenv, follow these steps to safely report the issue to the
|
|
5
|
+
team.
|
|
6
|
+
|
|
7
|
+
## Supported versions
|
|
8
|
+
|
|
9
|
+
Support of Dynenv is divided into four priorities: new features, bug fixes,
|
|
10
|
+
security issues, and severe security issues. They are handled as follows:
|
|
11
|
+
|
|
12
|
+
### New features
|
|
13
|
+
|
|
14
|
+
New features are only added to the `master` branch and will not be made
|
|
15
|
+
available in patch releases.
|
|
16
|
+
|
|
17
|
+
### Bug fixes
|
|
18
|
+
|
|
19
|
+
Only the latest minor release series will receive bug fixes. When enough bugs
|
|
20
|
+
are fixed and it is deemed worthy to release a new gem version, this is the
|
|
21
|
+
branch it happens from.
|
|
22
|
+
|
|
23
|
+
* Current minor release series: [0.0.x][current-minor-release-branch]
|
|
24
|
+
|
|
25
|
+
### Security issues
|
|
26
|
+
|
|
27
|
+
The current minor release series and the next most recent one for the current
|
|
28
|
+
major release will receive patches and new versions in case of a security issue.
|
|
29
|
+
|
|
30
|
+
* Current minor release series: [0.0.x][current-minor-release-branch]
|
|
31
|
+
* Next most recent minor release series: N/A
|
|
32
|
+
|
|
33
|
+
### Severe security issues
|
|
34
|
+
|
|
35
|
+
For severe security issues we will provide new versions as above, as well as a
|
|
36
|
+
new version for the last minor release series from the previous major release.
|
|
37
|
+
|
|
38
|
+
* Current minor release series: [0.0.x][current-minor-release-branch]
|
|
39
|
+
* Next most recent minor release series: N/A
|
|
40
|
+
* Last minor release series of previous major release: N/A
|
|
41
|
+
|
|
42
|
+
### Unsupported release series
|
|
43
|
+
|
|
44
|
+
When a release series is no longer supported, it's your own responsibility to
|
|
45
|
+
deal with bugs and security issues. We may provide backports of the fixes and
|
|
46
|
+
publish them to git, but there will be no new gem versions released. If you're
|
|
47
|
+
not comfortable maintaining your own versions, you should upgrade to a supported
|
|
48
|
+
version.
|
|
49
|
+
|
|
50
|
+
## Reporting a bug
|
|
51
|
+
|
|
52
|
+
All security bugs in Dynenv should be reported via an encrypted PGP/GPG message
|
|
53
|
+
to the project maintainer at
|
|
54
|
+
[tony@tonyburns.net](mailto:tony@tonyburns.net). The public PGP/GPG key to
|
|
55
|
+
encrypt to can be found in the
|
|
56
|
+
[tonyhburns.asc](https://raw.githubusercontent.com/tonyhburns/dynenv/master/tonyhburns.asc)
|
|
57
|
+
file in this repository, and can also be found on
|
|
58
|
+
[Keybase](https://keybase.io/tonyhburns). The fingerprint of the key should be:
|
|
59
|
+
|
|
60
|
+
2B8C 9D65 B3A7 2398 200D D60F 9F8D 77FF 59B3 6213
|
|
61
|
+
|
|
62
|
+
Your report will be acknowledged within 24 hours, and you'll receive a more
|
|
63
|
+
detailed response to your email within 48 hours indicating the next steps in
|
|
64
|
+
handling your report.
|
|
65
|
+
|
|
66
|
+
After the initial reply to your report, the project maintainer will endeavor to
|
|
67
|
+
keep you informed of the progress being made towards a fix and full
|
|
68
|
+
announcement. These updates will be sent **at least** every five days, but in
|
|
69
|
+
reality you should hear back every 24-48 hours.
|
|
70
|
+
|
|
71
|
+
If you have not received a reply to your email within 48 hours, or have not
|
|
72
|
+
heard back from the project maintainer for the past five days, there are a few
|
|
73
|
+
steps you can take:
|
|
74
|
+
|
|
75
|
+
* Send a direct message to [@dynenvgem][project-twitter]
|
|
76
|
+
* Send a direct message to [@tonyhburns][project-maintainer-twitter]
|
|
77
|
+
* Email the [project mailing list][project-mailing-list]
|
|
78
|
+
* Ask in the [Gitter room](https://gitter.im/tonyhburns/dynenv) or the
|
|
79
|
+
#dynenv IRC channel on Freenode
|
|
80
|
+
|
|
81
|
+
Please note, the mailing list, Gitter room, and #dynenv channel are public
|
|
82
|
+
forums. When escalating to one of these channels **please do not discuss your
|
|
83
|
+
issue**; simply say that you're trying to reach the project maintainer about a
|
|
84
|
+
security bug.
|
|
85
|
+
|
|
86
|
+
## Disclosure policy
|
|
87
|
+
|
|
88
|
+
Dynenv has a five step disclosure policy:
|
|
89
|
+
|
|
90
|
+
1. Security report received and is assigned to a primary handler. This person
|
|
91
|
+
will coordinate the fix and release process.
|
|
92
|
+
2. Problem is confirmed and a list of all affected versions is determined. Code
|
|
93
|
+
is audited to find any potentially similar problems.
|
|
94
|
+
3. Fixes are prepared for all releases which are still supported. These fixes
|
|
95
|
+
are **not** committed to the public repository but rather held locally pending
|
|
96
|
+
the announcement.
|
|
97
|
+
4. A suggested embargo date for the vulnerability is chosen and
|
|
98
|
+
[vendor-sec](http://oss-security.openwall.org/wiki/mailing-lists/distros) is
|
|
99
|
+
notified. The notification will include patches for all supported versions and
|
|
100
|
+
a contact address for packagers who need advice backporting patches to older
|
|
101
|
+
versions.
|
|
102
|
+
5. On the embargo date, the [project mailing list][project-mailing-list] and
|
|
103
|
+
the [Ruby security announcement mailing
|
|
104
|
+
list](https://groups.google.com/forum/#!forum/ruby-security-ann) is sent a copy
|
|
105
|
+
of the announcement. An announcement will also be made on
|
|
106
|
+
[@dynenvgem][project-twitter]. The changes are pushed to the public
|
|
107
|
+
repository and new gem versions are released to RubyGems.
|
|
108
|
+
|
|
109
|
+
Typically the embargo date will be set 72 hours from the time vendor-sec is
|
|
110
|
+
first notified. However, this may vary depending on the severity of the bug or
|
|
111
|
+
difficulty in applying a fix.
|
|
112
|
+
|
|
113
|
+
This process can take some time, especially when coordination is required with
|
|
114
|
+
maintainers of other projects. Every effort will be made to handle the bug in as
|
|
115
|
+
timely a manner as possible, however it's important that we follow the release
|
|
116
|
+
process above to ensure that the disclosure is handled in a consistent and
|
|
117
|
+
responsible manner.
|
|
118
|
+
|
|
119
|
+
## Receiving security updates
|
|
120
|
+
|
|
121
|
+
The best way to receive all the security announcements is to subscribe to the
|
|
122
|
+
[project mailing list][project-mailing-list], which receives the public
|
|
123
|
+
notifications the moment the embargo is lifted. If you produce packages of
|
|
124
|
+
Dynenv and require prior notification of vulnerabilities, you should be
|
|
125
|
+
subscribed to vendor-sec.
|
|
126
|
+
|
|
127
|
+
Nobody outside the project team, the initial reporter, or vendor-sec will be
|
|
128
|
+
notified prior to the lifting of an embargo on a security bug. We regret that we
|
|
129
|
+
cannot make exceptions to this policy for high traffic or important sites, as
|
|
130
|
+
any disclosure beyond the minimum required to coordinate a fix could cause an
|
|
131
|
+
early leak of the vulnerability.
|
|
132
|
+
|
|
133
|
+
## Comments on this policy
|
|
134
|
+
|
|
135
|
+
If you have any suggestions to improve this policy, please [open an issue on
|
|
136
|
+
GitHub](https://github.com/tonyhburns/dynenv/issues).
|
|
137
|
+
|
|
138
|
+
[current-minor-release-branch]: https://github.com/tonyhburns/dynenv/tree/master
|
|
139
|
+
[project-mailing-list]: https://groups.google.com/forum/#!forum/dynenv
|
|
140
|
+
[project-twitter]: https://twitter.com/dynenvgem
|
|
141
|
+
[project-maintainer-twitter]: https://twitter.com/tonyhburns
|
data/docs/images/.keep
ADDED
|
File without changes
|
data/dynenv.gemspec
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
+
require 'dynenv/version'
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = 'dynenv'
|
|
7
|
+
spec.version = Dynenv::Version::STRING
|
|
8
|
+
spec.authors = ['Tony Burns']
|
|
9
|
+
spec.email = %w(tony@tonyburns.net)
|
|
10
|
+
|
|
11
|
+
spec.summary = 'Environment variable management with Amazon DynamoDB'
|
|
12
|
+
spec.description = 'A runtime configuration system that injects environment variables into your processes using Amazon DynamoDB as a backing store' # rubocop:disable Metrics/LineLength
|
|
13
|
+
spec.homepage = 'https://github.com/tonyhburns/dynenv'
|
|
14
|
+
spec.license = 'MIT'
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(bin|config|spec|test_app)/}) }
|
|
17
|
+
spec.bindir = 'exe'
|
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
19
|
+
spec.require_paths = %w(lib)
|
|
20
|
+
|
|
21
|
+
spec.required_ruby_version = '>= 2.1.0'
|
|
22
|
+
|
|
23
|
+
spec.add_dependency 'activesupport', '~> 4.2'
|
|
24
|
+
spec.add_dependency 'aws-sdk', '~> 2.0'
|
|
25
|
+
spec.add_dependency 'colorize', '~> 0.7'
|
|
26
|
+
spec.add_dependency 'thor', '~> 0.19'
|
|
27
|
+
|
|
28
|
+
spec.add_development_dependency 'bundler', '~> 1.9'
|
|
29
|
+
|
|
30
|
+
unless ENV['CI']
|
|
31
|
+
spec.cert_chain = %w(tonyhburns.pem)
|
|
32
|
+
spec.signing_key = File.expand_path(ENV['GEM_SIGNING_KEY']) if $PROGRAM_NAME =~ /gem\z/
|
|
33
|
+
end
|
|
34
|
+
end
|
data/exe/dynenv
ADDED
data/lib/dynenv.rb
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require 'active_support/core_ext/module/attribute_accessors'
|
|
2
|
+
|
|
3
|
+
require_relative './dynenv/version'
|
|
4
|
+
require_relative './dynenv/configuration'
|
|
5
|
+
|
|
6
|
+
# Top-level namespace for Dynenv.
|
|
7
|
+
module Dynenv
|
|
8
|
+
class << self
|
|
9
|
+
# @!attribute [r] configuration
|
|
10
|
+
# @return [Dynenv::Configuration] the global configuration for Dynenv
|
|
11
|
+
|
|
12
|
+
# Yield Dynenv's global configuration to the block. Use this in your
|
|
13
|
+
# initializer to modify Dynenv's global configuration.
|
|
14
|
+
#
|
|
15
|
+
# @return [nil]
|
|
16
|
+
#
|
|
17
|
+
# @see Dynenv.configuration
|
|
18
|
+
def configure(&_blk)
|
|
19
|
+
yield configuration
|
|
20
|
+
nil
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Inject environment variables from DynamoDB.
|
|
24
|
+
def load
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
mattr_reader(:configuration) { Dynenv::Configuration.new }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
require_relative './dynenv/errors'
|
data/lib/dynenv/cli.rb
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'active_support/core_ext/module/delegation'
|
|
2
|
+
require 'active_support/ordered_options'
|
|
3
|
+
|
|
4
|
+
require_relative './logging'
|
|
5
|
+
|
|
6
|
+
module Dynenv
|
|
7
|
+
# Global configuration settings for Dynenv.
|
|
8
|
+
class Configuration
|
|
9
|
+
# @!attribute [rw] logger
|
|
10
|
+
# @return [Logger] the global Logger instance
|
|
11
|
+
# @see Dynenv::Logging.logger
|
|
12
|
+
# @see Dynenv::Logging.logger=
|
|
13
|
+
delegate :logger, :logger=, to: 'Dynenv::Logging'
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
require 'logger'
|
|
2
|
+
|
|
3
|
+
module Dynenv
|
|
4
|
+
# Helpers to facilitate logging within Dynenv.
|
|
5
|
+
module Logging
|
|
6
|
+
class << self
|
|
7
|
+
# Return a new {Logger} instance with default configuration.
|
|
8
|
+
#
|
|
9
|
+
# @return [Logger]
|
|
10
|
+
# A new {Logger} instance
|
|
11
|
+
def default_logger(device = STDOUT)
|
|
12
|
+
::Logger.new(device)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Return the global {Logger} instance, and initializes it if no already
|
|
16
|
+
# defined.
|
|
17
|
+
#
|
|
18
|
+
# @return [Logger]
|
|
19
|
+
# The global {Logger} instance
|
|
20
|
+
def logger
|
|
21
|
+
defined?(@logger) ? @logger : default_logger
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Set the global {Logger} instance.
|
|
25
|
+
#
|
|
26
|
+
# @param [Logger, nil] new_logger the {Logger} to use, or nil if you want
|
|
27
|
+
# to use a new {Logger} pointed to `/dev/null`
|
|
28
|
+
#
|
|
29
|
+
# @return [Logger]
|
|
30
|
+
# The new logger instance
|
|
31
|
+
def logger=(new_logger)
|
|
32
|
+
@logger = (new_logger.nil? ? ::Logger.new('/dev/null') : new_logger)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# @!attribute [r] logger
|
|
37
|
+
# @return [Logger] the global {Logger} instance
|
|
38
|
+
# @see Dynenv::Logging.logger
|
|
39
|
+
delegate :logger, to: 'Dynenv::Logging'
|
|
40
|
+
end
|
|
41
|
+
end
|
data/lib/dynenv/rails.rb
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require 'rails'
|
|
2
|
+
require 'dynenv'
|
|
3
|
+
|
|
4
|
+
module Dynenv
|
|
5
|
+
# Rails initialization and configuration entrypoint for Dynenv.
|
|
6
|
+
class Railtie < Rails::Engine
|
|
7
|
+
config.before_configuration { load }
|
|
8
|
+
config.dynenv = Dynenv.configuration
|
|
9
|
+
|
|
10
|
+
initializer 'dynenv.logger' do
|
|
11
|
+
config.dynenv.logger = Rails.logger
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# :nocov:
|
|
15
|
+
rake_tasks do
|
|
16
|
+
Kernel.load File.expand_path('../rake_task.rb', __FILE__)
|
|
17
|
+
|
|
18
|
+
task environment: :dynenv
|
|
19
|
+
end
|
|
20
|
+
# :nocov:
|
|
21
|
+
|
|
22
|
+
delegate :load, to: 'Dynenv'
|
|
23
|
+
|
|
24
|
+
# Inject environment variables from DynamoDB.
|
|
25
|
+
#
|
|
26
|
+
# @see Dynenv.load
|
|
27
|
+
def self.load
|
|
28
|
+
instance.load
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
dynenv-config(1) -- Get and set table or global options for a Dynenv-managed DynamoDB table
|
|
2
|
+
===========================================================================================
|
|
3
|
+
|
|
4
|
+
## SYNOPSIS
|
|
5
|
+
|
|
6
|
+
`dynenv config`
|
|
7
|
+
|
|
8
|
+
## DESCRIPTION
|
|
9
|
+
|
|
10
|
+
## OPTIONS
|
|
11
|
+
|
|
12
|
+
## EXIT STATUS
|
|
13
|
+
|
|
14
|
+
## ENVIRONMENT
|
|
15
|
+
|
|
16
|
+
## FILES
|
|
17
|
+
|
|
18
|
+
## NOTES
|
|
19
|
+
|
|
20
|
+
## EXAMPLE
|
|
21
|
+
|
|
22
|
+
## SEE ALSO
|