Deploy Ruby on Rails with Capistrano

0

When running deploy I get the following error: Rack app error: #<RuntimeError: Missing 'secret_token' and 'secret_key_bas' for 'production' environment, set these values in 'config/secrets.yml

I have already made the necessary settings but I can not find the problem.

I have set :linked_files, ["#{shared_path}/config/secrets.yml"] in my config/deploy.rb .

I'm using the capistrano-secrets-yml plugin to put my secrets.yml in the correct location:

l shared/config/secrets.yml
lrwxrwxrwx 1 myuser myiser 63 Aug  4 10:44 shared/config/secrets.yml -> /home/myuser/apps/myapp/shared/config/secrets.yml

And I also exported the secret to my .bashrc - > export SECRET_KEY_BASE=MY_SECRET

And * secrets.yml uses this variable:

production:
    secret_key_base: <%= ENV['SECRET_KEY_BASE'] %>

What could be wrong?

    
asked by anonymous 04.08.2015 / 16:56

1 answer

0

You can solve this problem by adding the gem dotEnv . Add gem to your Gemfile in the development group.

Turn the bundle; and ready! Just create a .env file at the root of your project and pass the environment variables you want to use. For example:

secret_key_base= "234df4r3j43r49..."

And there in the Rails files you use ENV['secret_key_base']

    
14.02.2018 / 14:55