I'm trying to deploy my app with mina.
When it starts to run migrations I got this error:
-----> Migrating database
rake aborted!
Devise.secret_key was not set. Please add the following to your Devise initializer:
config.secret_key = 'key here.......'
Please ensure you restarted your application after installing Devise or setting the key.
.........
In my devise initializer I have config.secret_key = ENV["SECRET_KEY_BASE"]
How to add this key to my app?
Are secret_key_base and secret_key different?
This might be stupid but I dont know how to add this key.
Locally everything works fine
ps I'm using figaro
open your rails app folder go to
config/initializers/devise.rb
and paste this line of code at the end:
config.secret_key = *****
where ***** is the string your console gives you when the error pops out.
as an Environment variable:
If you want an enviorment Variable you can go different ways, for example replace the above line of code to this:
config.secret_key = ENV['DEVISE_SECRET_KEY']
then you can create a the variable on a keys.yml file and add it to your ./gitignore file.
after that you can import the yaml file to your app like this:
config/application.rb:
ENV.update YAML.load(File.read(File.expand_path('../keys.yml', __FILE__)))
module yourApp
...
...
end
I added
set :shared_paths, ['config/database.yml', 'log', 'config/secrets.yml']
to my deploy.rb
and it solved my problem.
In the secrets.yml
I set DEVISE_SECRET