No commit activity in last 3 years
No release in over 3 years
Capistrano tasks for automating generating or linking a secret in Rails 4+. This plugin generates a secret if one doesn't exist on a remote server. If a secret is already found on remote server, then it copies to shared location and links.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0

Runtime

 Project Readme

Capistrano::SecretsGenerate

Capistrano tasks for handling generating a secret.token when deploying Rails 4+ apps.

Install

Add this to Gemfile:

group :development do
  gem 'capistrano', '~> 3.2.1'
  gem 'capistrano-secrets-generate', '~> 1.0.0'
end

And then:

$ bundle install

Setup and usage

  • make secret.yml load file config/secret.token:

      production: &production
        <% if ((false == Rails.env.test?) && (false == Rails.env.development?)) %>
          secret_key_base: <%= File.read(File.join(Rails.application.config.root, "config", "secret.token")) %>
        <% end %>
    
  • add to Capfile:

      require 'capistrano/secrets_generate'
    

You can now proceed with other deployment tasks.

How it works

On deployment:

  • we look for secret.token file on the server shared dir
  • if it exists, we add to linked files
  • if not we look for file in current deployment, if it exists, we copy to shared and add to linked
  • if nothing exists, then we use rake secret to create a new secret.