No commit activity in last 3 years
No release in over 3 years
Capistrano tasks to change environment config on remote hosts
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.4
>= 0

Runtime

 Project Readme

Capistrano::Twelvefactor

Simple capistrano tasks to change environment variables like you would on Heroku.

Installation

Add this line to your application's Gemfile:

gem 'capistrano-twelvefactor'

And then execute:

$ bundle

Or install it yourself as:

$ gem install capistrano-twelvefactor

Usage

In your Capfile

require 'capistrano/twelvefactor'

In your $stage.rb

Set the file you want to be written to, in order to change environment variables. Usually this would be .env, .bashrc, /etc/environment or something similar, depending on your OS and app setup. The default is .env.

set :environment_file, '.custom_file'

On your command line

Setting a value

$ cap production config:set[FOO=bar]

Note: If you run zsh, you have to use quotes since square brackets are used for some shell features:

$ cap production "config:set[FOO=bar]"

Removing a value

$ cap production config:unset[FOO]

List Variables

$ cap production config:list

Same zsh workaround applies here.

Restarting your app

Sometimes a change in the environment file requires a restart of your application. Add this to your deploy.rb to do so:

after 'config:set', 'deploy:restart'
after 'config:unset', 'deploy:restart'

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

MIT