0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
A tool for managing your application's environment variables in a Vault.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.10
~> 10.0
>= 0

Runtime

>= 0
~> 0.1
 Project Readme

Shield-Vault

Shield-Vault is a tool for managing your application's environment variables in a Vault.

Installation

Add this line to your application's Gemfile:

gem 'shield-vault'

And then execute:

$ bundle

Or install it yourself as:

$ gem install shield

Setup

This gem assumes that you've already setup Vault. You can use this gem on local vaults or ones that have been deployed to a server. If you are working with a local server you'll just need to start vault and then proceed to the steps below. If you are working on a deployed vault you'll need to create an auth token for your vault and unseal it before you can interact with it using this gem. That setup is out of the scope of this gem but is covered in the official Vault documentation.

  1. export VAULT_ADDR=YOUR_VAULT_SERVER_ADDRESS
  2. export VAULT_TOKEN=YOUR_VAULT_AUTH_TOKEN

Usage

Shield-Vault will store environment variables as a hash of values based on your environment and the name of your app. By default the environment is "development" but can be overriden with the --environment flag. The name of your app is taken from your current working directory or by specifying it with the --app flag.

Add an environment variable

shield-vault add <key> <value>

Update an environment variable

shield-vault update <key> <value>

Remove an environment variable

shield-vault remove <key> <value>

Fetch all environment variables and update your .env file

shield-vault fetch

Environment Flag

By default, all commands use the "development" environment. You can specify another environment with the --environment flag.

shield-vault fetch --environment=production will fetch your production environment variables and update your .env.production file.

App flag

By default, all commands use your current working directory as the app name. If for some reason you need to override this, you can do so with the --app flag.

shield-vault fetch --app=seabiscuit will fetch the environment variables namespaced under the seabiscuit app.

.env files

Shield-Vault assumes you are using a tool like dotenv or Ember-cli-dotenv to load environment variables in your app as the fetch command will create/update the appropriate .env file. For example, if pass the --environment=production flag, it'll update the .env.production file.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

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.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/checkmateio/shield-vault.

License

The gem is available as open source under the terms of the MIT License.