dotenv-vault-rails 0.6.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40bf354479d33c010a5f1899482b90f9ee6094702c6c99ae730a115ac53227a8
4
- data.tar.gz: 5afb9b56bfbceb85e78f1252420569316496f4f229b336d912ba854aa763f6fb
3
+ metadata.gz: e91991151b13e9afd810b5e8d8bdc14f8af6019e17f6ec103a37bc1bf8a2d4e3
4
+ data.tar.gz: 70d8a1939630149570a0873f02af6dff4c796bfc2ff5860693d305ada37fd480
5
5
  SHA512:
6
- metadata.gz: 32fb077fb0c97c19522cff72e8d4721b90ab106d6d2606ad3cb684c4290d9f75c3b4b6fd73a839094dbb439518231ae37983254b20c2f8ebc155e07e4abf5fb9
7
- data.tar.gz: a14615e72623fef08ffccc662dd86d2950e2b34b65f613032382b9e16bff1ee5592b81ec7be8e40f7602f0a89e3cebdff440373f1adb99ab9520f1296bb14787
6
+ metadata.gz: 0f6b4372e769083a970bca589926fc17831c2dbae97ddd49cd0bbce7442242fdea69fa06407dd6d219c1c9c2948b861499f29dade4a16517f529cb03ddf3d14c
7
+ data.tar.gz: 2ddcf5cdf739284fc528803f1747536383c742689b48d65d599461df2c89c9063e182821f2630fb9f5ad40ff09ff68eff32f284e66187d1f693d88c7b059d60b
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
+
5
+ ## [Unreleased](https://github.com/dotenv-org/dotenv-vault-ruby/compare/v0.7.0...master)
6
+
7
+ ## 0.7.0 and prior
8
+
9
+ Please see commit history.
data/Gemfile.lock CHANGED
@@ -1,12 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dotenv-vault (0.6.0)
4
+ dotenv-vault (0.7.1)
5
5
  dotenv
6
6
  lockbox
7
- dotenv-vault-rails (0.6.0)
7
+ dotenv-vault-rails (0.7.1)
8
8
  dotenv-rails
9
- dotenv-vault (= 0.6.0)
9
+ dotenv-vault (= 0.7.1)
10
10
 
11
11
  GEM
12
12
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,3 +1,150 @@
1
- # dotenv-vault
1
+ # dotenv-vault [![Gem Version](https://badge.fury.io/rb/dotenv-vault.svg)](https://badge.fury.io/rb/dotenv-vault)
2
2
 
3
- Coming soon
3
+ <img src="https://raw.githubusercontent.com/motdotla/dotenv/master/dotenv.svg" alt="dotenv-vault" align="right" width="200" />
4
+
5
+ Dotenv Vault extends the proven & trusted foundation of [dotenv](https://github.com/bkeepers/dotenv), with a `.env.vault` file.
6
+
7
+ This new standard lets you sync your .env files – quickly & securely. Stop sharing them over insecure channels like Slack and email, and never lose an important .env file again.
8
+
9
+ ## Installation
10
+
11
+ ### Rails
12
+
13
+ Add this line to the top of your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'dotenv-vault-rails'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ ```shell
22
+ $ bundle
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ### `.env`
28
+
29
+ Basic usage begins just like [dotenv](https://github.com/bkeepers/dotenv).
30
+
31
+ Add your application configuration to your `.env` file in the root of your project:
32
+
33
+ ```shell
34
+ S3_BUCKET=YOURS3BUCKET
35
+ SECRET_KEY=YOURSECRETKEYGOESHERE
36
+ ```
37
+
38
+ Whenever your application loads, these variables will be available in `ENV`:
39
+
40
+ ```ruby
41
+ config.fog_directory = ENV['S3_BUCKET']
42
+ ```
43
+
44
+ ### `.env.vault`
45
+
46
+ Usage is similar to git. In the same directory as your `.env` file, run the command:
47
+
48
+ ```shell
49
+ npx dotenv-vault new
50
+ ```
51
+
52
+ Follow those instructions and then run:
53
+
54
+ ```shell
55
+ $ npx dotenv-vault login
56
+ ```
57
+
58
+ Then run push and pull:
59
+
60
+ ```shell
61
+ $ npx dotenv-vault push
62
+ $ npx dotenv-vault pull
63
+ ```
64
+
65
+ That's it!
66
+
67
+ You just synced your `.env` file. Commit your `.env.vault` file to code, and tell your teammates to run `npx dotenv-vault pull`.
68
+
69
+ ## Multiple Environments
70
+
71
+ Run the command:
72
+
73
+ ```shell
74
+ $ npx dotenv-vault open production
75
+ ```
76
+
77
+ It will open up an interface to manage your production environment variables.
78
+
79
+ ..or if you prefer to manage them in your text editor, run the command:
80
+
81
+ ```shell
82
+ $ npx dotenv-vault pull production
83
+ ```
84
+
85
+ Edit the `.env.production` file and push your changes:
86
+
87
+ ```shell
88
+ $ npx dotenv-vault push production
89
+ ```
90
+
91
+ Neato.
92
+
93
+ ## Deploy Anywhere
94
+
95
+ Build your encrypted `.env.vault`. Run the command:
96
+
97
+ ```shell
98
+ $ npx dotenv-vault build
99
+ ```
100
+
101
+ Safely commit and push your changes:
102
+
103
+ ```shell
104
+ $ git commit -am "Updated .env.vault"
105
+ $ git push
106
+ ```
107
+
108
+ Obtain your `DOTENV_KEY`:
109
+
110
+ ```shell
111
+ $ npx dotenv-vault keys
112
+ ```
113
+
114
+ Set `DOTENV_KEY` on your infrastructure. For example, on Heroku:
115
+
116
+ ```shell
117
+ $ heroku config:set DOTENV_KEY="dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=production"
118
+ ```
119
+
120
+ All set! When your app boots, it will recognize a `DOTENV_KEY` is set, decrypt the `.env.vault` file, and load the variables to `ENV`.
121
+
122
+ ## FAQ
123
+
124
+ ### What happens if DOTENV_KEY is not set?
125
+
126
+ Dotenv Vault gracefully falls back to [dotenv](https://github.com/bkeepers/dotenv) when `DOTENV_KEY` is not set. This is useful for development.
127
+
128
+ ### Should I commit my `.env` file?
129
+
130
+ No. We **strongly** recommend against committing your `.env` file to version control. It should only include environment-specific values such as database passwords or API keys. Your production database should have a different password than your development database.
131
+
132
+ ### Should I commit my `.env.vault` file?
133
+
134
+ Yes. It is safe and recommended to do so. It contains your vault identifier at the vault provider (in this case [dotenv.org](https://dotenv.org)) and contains your encrypted values.
135
+
136
+ ## Contributing
137
+
138
+ 1. Fork it
139
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
140
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
141
+ 4. Push to the branch (`git push origin my-new-feature`)
142
+ 5. Create new Pull Request
143
+
144
+ ## Changelog
145
+
146
+ See [CHANGELOG.md](CHANGELOG.md)
147
+
148
+ ## License
149
+
150
+ MIT
@@ -1,3 +1,3 @@
1
1
  module DotenvVault
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.1"
3
3
  end
data/lib/dotenv-vault.rb CHANGED
@@ -2,6 +2,7 @@ require "uri"
2
2
  require "dotenv"
3
3
  require "lockbox"
4
4
  require "dotenv-vault/version"
5
+ require "logger"
5
6
 
6
7
  module DotenvVault
7
8
  class NotFoundDotenvKey < ArgumentError; end
@@ -14,6 +15,10 @@ module DotenvVault
14
15
 
15
16
  class << self
16
17
  attr_accessor :instrumenter
18
+
19
+ def logger
20
+ @logger ||= Logger.new(STDOUT)
21
+ end
17
22
  end
18
23
 
19
24
  module_function
@@ -85,6 +90,8 @@ module DotenvVault
85
90
  #
86
91
  # Decrypts and loads to ENV
87
92
  def load_vault(*filenames)
93
+ DotenvVault.logger.info("[dotenv-vault] Loading encrypted .env.vault to environment variables") if DotenvVault.logger
94
+
88
95
  parsed = parse_vault(*filenames)
89
96
 
90
97
  # Set ENV
@@ -97,6 +104,8 @@ module DotenvVault
97
104
  #
98
105
  # Decrypts and overloads to ENV
99
106
  def overload_vault(*filenames)
107
+ DotenvVault.logger.info("[dotenv-vault] Overloading encrypted .env.vault to environment variables") if DotenvVault.logger
108
+
100
109
  parsed = parse_vault(*filenames)
101
110
 
102
111
  # Set ENV
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dotenv-vault-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - motdotla
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-17 00:00:00.000000000 Z
11
+ date: 2022-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv-rails
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.6.0
33
+ version: 0.7.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.6.0
40
+ version: 0.7.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: spring
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -76,6 +76,7 @@ files:
76
76
  - ".gitignore"
77
77
  - ".rspec"
78
78
  - ".travis.yml"
79
+ - CHANGELOG.md
79
80
  - Gemfile
80
81
  - Gemfile.lock
81
82
  - LICENSE.txt