vagrant-readenv 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +53 -0
- data/lib/vagrant-readenv.rb +6 -0
- data/lib/vagrant-readenv/config.rb +35 -0
- data/lib/vagrant-readenv/plugin.rb +27 -0
- data/lib/vagrant-readenv/version.rb +5 -0
- data/vagrant-readenv.gemspec +24 -0
- metadata +79 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0f14b1561c258b07513c984d840187e91c61adba93eb931d9d62a3af31abe121
|
4
|
+
data.tar.gz: a1841e010e1bd8bef9445af3b272ff32a6097806aed650cc911c956a8b5f793d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: af2344f0a28db13701a748e99bc8cf465a39156a24e098ab801f8fe3d9448d7c3806c55be7f24ced8681506ef0f009c62cd2be77b727cac7da330068a5261092
|
7
|
+
data.tar.gz: 6d4d9e43d2af7478a9e7e93da8e62200ad799d4855612c52fcc59ee3c8d8f1d718f5905d17773e419fdacf51d50b0abb29b72d6580268b0396b06008bb5fb2b6
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Greg Osuri
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# Vagrant ENV Plugin
|
2
|
+
|
3
|
+
This is a [Vagrant](http://www.vagrantup.com) plugin to load environment variables from .env into ENV. More information on why and how we use this plugin is detailed in this [post](http://www.gregosuri.com/2014/08/31/introducing-vagrant-env-plugin/)
|
4
|
+
|
5
|
+
## Requirements
|
6
|
+
|
7
|
+
* Vagrant 1.7.4 or higher
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Install the lastest version using standard vagrant plugin installation method:
|
12
|
+
|
13
|
+
```sh
|
14
|
+
$ vagrant plugin install vagrant-env
|
15
|
+
```
|
16
|
+
|
17
|
+
To install an older version of the plugin use `vagrant plugin install vagrant-env --plugin-version VERSION`
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
After installing, add your application configuration to your .env file in the root of your project
|
22
|
+
|
23
|
+
```sh
|
24
|
+
$ echo BOX_NAME=hashicorp/precise64 > .env
|
25
|
+
```
|
26
|
+
|
27
|
+
Create a a Vagrantfile that looks like the following, ensure to add `config.env.enable` and fill in your information where necessary. Check out [example](example/) for reference
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
Vagrant.configure("2") do |config|
|
31
|
+
config.env.enable # enable the plugin
|
32
|
+
config.vm.box = ENV['BOX_NAME']
|
33
|
+
end
|
34
|
+
```
|
35
|
+
|
36
|
+
Additionally, You may also add export in front of each line so you can source the file in bash:
|
37
|
+
|
38
|
+
```sh
|
39
|
+
export AWS_ACCESS_ID=YOURACCESSIDGOESHERE
|
40
|
+
export AWS_SECRET_ACCESS_ID=YOURSECRETKEYGOESHERE
|
41
|
+
```
|
42
|
+
|
43
|
+
### Should I commit my .env file?
|
44
|
+
|
45
|
+
It is recommended that you store development-only settings in your .env file, and commit it to your repository. Make sure that all your credentials for your development environment are different from your other deployments. This makes it easy for other developers to get started on your project, without compromising your credentials for other environments.
|
46
|
+
|
47
|
+
## Contributing
|
48
|
+
|
49
|
+
1. Fork it ( https://github.com/gosuri/vagrant-env/fork )
|
50
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
51
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
52
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
53
|
+
5. Create a new Pull Request
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'dotenv'
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module ReadEnv
|
5
|
+
class Config < Vagrant.plugin("2", :config)
|
6
|
+
|
7
|
+
# Simple interface:
|
8
|
+
# config.env.enable __FILE__
|
9
|
+
def enable(vagrantfile = nil)
|
10
|
+
if vagrantfile
|
11
|
+
load File.join File.dirname(vagrantfile), '.env'
|
12
|
+
else
|
13
|
+
# The default is .env in the current directory - but that may not be
|
14
|
+
# the same directory that the Vagrantfile is in
|
15
|
+
# https://github.com/gosuri/vagrant-env/issues/2
|
16
|
+
load
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# Lower-level methods - proxy to Dotenv:
|
21
|
+
def load(*filenames)
|
22
|
+
Dotenv::load *filenames
|
23
|
+
end
|
24
|
+
|
25
|
+
def load!(*filenames)
|
26
|
+
Dotenv::load! *filenames
|
27
|
+
end
|
28
|
+
|
29
|
+
def overload(*filenames)
|
30
|
+
Dotenv::overload *filenames
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
begin
|
2
|
+
require "vagrant"
|
3
|
+
rescue LoadError
|
4
|
+
raise "The Vagrant READENV plugin must be run within Vagrant."
|
5
|
+
end
|
6
|
+
|
7
|
+
# This is a sanity check to make sure no one is attempting to install
|
8
|
+
# this into an early Vagrant version.
|
9
|
+
if Vagrant::VERSION < "1.2.0"
|
10
|
+
raise "The Vagrant READENV plugin is only compatible with Vagrant 1.2+"
|
11
|
+
end
|
12
|
+
|
13
|
+
module VagrantPlugins
|
14
|
+
module ReadEnv
|
15
|
+
class Plugin < Vagrant.plugin("2")
|
16
|
+
name "READENV"
|
17
|
+
description <<-DESC
|
18
|
+
Vagrant plugin to load environment variables from .env into ENV
|
19
|
+
DESC
|
20
|
+
|
21
|
+
config "env" do
|
22
|
+
require_relative "config"
|
23
|
+
Config
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vagrant-readenv/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "vagrant-readenv"
|
8
|
+
spec.version = VagrantPlugins::ReadEnv::VERSION
|
9
|
+
spec.authors = ["Greg Osuri"]
|
10
|
+
spec.email = ["greg@overclock.io"]
|
11
|
+
spec.summary = %q{Vagrant plugin to load environment variables from .env into ENV}
|
12
|
+
spec.description = %q{Vagrant plugin to load environment variables from .env into ENV}
|
13
|
+
spec.homepage = "http://github.com/groovenectar/vagrant-readenv"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.files = %w(README.md LICENSE.txt
|
16
|
+
vagrant-readenv.gemspec
|
17
|
+
lib/vagrant-readenv.rb
|
18
|
+
lib/vagrant-readenv/version.rb
|
19
|
+
lib/vagrant-readenv/config.rb
|
20
|
+
lib/vagrant-readenv/plugin.rb)
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
spec.add_runtime_dependency "dotenv", "~> 2.5"
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-readenv
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Greg Osuri
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-12-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: dotenv
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
description: Vagrant plugin to load environment variables from .env into ENV
|
42
|
+
email:
|
43
|
+
- greg@overclock.io
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- LICENSE.txt
|
49
|
+
- README.md
|
50
|
+
- lib/vagrant-readenv.rb
|
51
|
+
- lib/vagrant-readenv/config.rb
|
52
|
+
- lib/vagrant-readenv/plugin.rb
|
53
|
+
- lib/vagrant-readenv/version.rb
|
54
|
+
- vagrant-readenv.gemspec
|
55
|
+
homepage: http://github.com/groovenectar/vagrant-readenv
|
56
|
+
licenses:
|
57
|
+
- MIT
|
58
|
+
metadata: {}
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
requirements: []
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 2.7.6
|
76
|
+
signing_key:
|
77
|
+
specification_version: 4
|
78
|
+
summary: Vagrant plugin to load environment variables from .env into ENV
|
79
|
+
test_files: []
|