dotenv_sekrets 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5548cb6c7eb9928235e9c88aa8e8850d731bab2a
4
+ data.tar.gz: 48eef1844063dd15932193419f5cef31445eff19
5
+ SHA512:
6
+ metadata.gz: f59a23cf691584e30b1fac21d29e39b1b24f2f087d32fa1ca3fa1cecd553e1189e2d12a79a818a2c383e2b13e455c2ad02fcb4d444d2bc9e7249a4d508d341a9
7
+ data.tar.gz: dcbefa1da577c99a45e3ef464403c3e6a234417893b4797c17e77219e4882f8a5a63fee55377d4d8f43ca9640d4053bdfa992b1890c5e5ea1bb35fddf6469e89
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.0
5
+ before_install: gem install bundler -v 1.14.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in dotenv_sekrets.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 andrea longhi
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,53 @@
1
+ # DotenvSekrets
2
+
3
+ This gem makes the `dotenv` gem cooperate nicely with the `sekrets` gem in order to allow encrypted `.env` files in your Rails application.
4
+
5
+
6
+ ## Rationale
7
+
8
+ Config files with private tokens, passwords and secrets should not be committed in source-control for security reasons, unless they're encrypted: here it comes DotenvSekrets to the rescue.
9
+
10
+ When everything is set and done you will need to know/share only the secret key, not the whole configuration which can be safely stored and versioned in your SCM tool.
11
+
12
+ You can rely on regular `dotenv` files to locally override the encrypted values inside `.env.enc` files or similar.
13
+
14
+
15
+ ## Installation
16
+
17
+ Add this line to your application's Gemfile:
18
+
19
+ ```ruby
20
+ gem 'dotenv_sekrets'
21
+ ```
22
+
23
+ And then execute:
24
+
25
+ $ bundle
26
+
27
+ Or install it yourself as:
28
+
29
+ $ gem install dotenv_sekrets
30
+
31
+ ## Usage
32
+
33
+ Please read [dotenv](https://github.com/bkeepers/dotenv) and [sekrets](https://github.com/ahoward/sekrets) READMEs.
34
+ For a quick setup you may simply want to:
35
+ * create the `.sekrets.key` file in your rails root and put your secret key code there
36
+ * create the `.env.enc` file and edit the content with the shell command `sekrets edit .env.enc`
37
+ * update `.gitignore` to ignore the `.sekrets.key` file
38
+ * `cat .env.enc`and see the content is encrypted
39
+ * commit `.env.enc` into your SCM
40
+ * start rails and see the `ENV` variable is populated with the data you put in `.env.enc`
41
+
42
+
43
+ ## Contributing
44
+
45
+ Bug reports and pull requests are welcome on GitHub at https://github.com/mikamai/dotenv_sekrets.
46
+
47
+
48
+ ## License
49
+
50
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
51
+
52
+
53
+ [rubygems.org](https://github.com/).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "dotenv_sekrets"
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
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'dotenv_sekrets/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "dotenv_sekrets"
8
+ spec.version = DotenvSekrets::VERSION
9
+ spec.authors = ["andrea longhi"]
10
+ spec.email = ["andrea@spaghetticode.it"]
11
+
12
+ spec.summary = %q{Dotenv goodness with Sekrets encryption}
13
+ spec.description = %q{Seamlessly encrypt/decrypt/edit Dotenv files with the help of Sekrets gem.}
14
+ spec.homepage = 'https://github.com/mikamai/dotenv_sekrets'
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.14"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.0"
27
+
28
+ spec.add_dependency 'rails'
29
+ spec.add_dependency 'dotenv', '>= 2.1.1'
30
+ spec.add_dependency 'dotenv-rails', '>= 2.1.1'
31
+ spec.add_dependency 'sekrets', '>= 1.10.0'
32
+ end
@@ -0,0 +1,26 @@
1
+ require "dotenv_sekrets/version"
2
+
3
+ require 'sekrets'
4
+ require 'dotenv'
5
+ require 'rails'
6
+ require 'dotenv-rails'
7
+ require 'dotenv_sekrets/dotenv/environment'
8
+ require 'dotenv_sekrets/dotenv/rails'
9
+
10
+
11
+ module DotenvSekrets
12
+ module_function
13
+
14
+ def root
15
+ Dotenv::Railtie.root
16
+ end
17
+
18
+ def env_files
19
+ [
20
+ root.join(".env.#{Rails.env}.local"),
21
+ (root.join(".env.local") unless Rails.env.test?),
22
+ root.join(".env.#{Rails.env}"),
23
+ root.join(".env")
24
+ ].compact.map { |f| [f, "#{f}.enc"] }.flatten
25
+ end
26
+ end
@@ -0,0 +1,11 @@
1
+ module DotenvSekrets
2
+ Dotenv::Environment.class_eval do
3
+ def read
4
+ if @filename =~ /\.enc$/
5
+ Sekrets.read(@filename) || raise(Errno::ENOENT)
6
+ else
7
+ File.open(@filename, "rb:bom|utf-8", &:read)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ Dotenv::Railtie.class_eval do
2
+ private
3
+
4
+ def dotenv_files
5
+ DotenvSekrets.env_files
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module DotenvSekrets
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,157 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dotenv_sekrets
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - andrea longhi
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-05-25 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: '1.14'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.14'
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: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: dotenv
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 2.1.1
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 2.1.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: dotenv-rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 2.1.1
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: 2.1.1
97
+ - !ruby/object:Gem::Dependency
98
+ name: sekrets
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: 1.10.0
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 1.10.0
111
+ description: Seamlessly encrypt/decrypt/edit Dotenv files with the help of Sekrets
112
+ gem.
113
+ email:
114
+ - andrea@spaghetticode.it
115
+ executables: []
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - ".gitignore"
120
+ - ".rspec"
121
+ - ".travis.yml"
122
+ - Gemfile
123
+ - LICENSE.txt
124
+ - README.md
125
+ - Rakefile
126
+ - bin/console
127
+ - bin/setup
128
+ - dotenv_sekrets.gemspec
129
+ - lib/dotenv_sekrets.rb
130
+ - lib/dotenv_sekrets/dotenv/environment.rb
131
+ - lib/dotenv_sekrets/dotenv/rails.rb
132
+ - lib/dotenv_sekrets/version.rb
133
+ homepage: https://github.com/mikamai/dotenv_sekrets
134
+ licenses:
135
+ - MIT
136
+ metadata: {}
137
+ post_install_message:
138
+ rdoc_options: []
139
+ require_paths:
140
+ - lib
141
+ required_ruby_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ required_rubygems_version: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
151
+ requirements: []
152
+ rubyforge_project:
153
+ rubygems_version: 2.6.11
154
+ signing_key:
155
+ specification_version: 4
156
+ summary: Dotenv goodness with Sekrets encryption
157
+ test_files: []