Reputation:
On my secrets.yml file I have the following code:
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
On my Ubuntu 14.04 I have run the following command:
export SECRET_KEY_BASE=adsfadfasdfasdfasdfasasdfasdfa
However, when I start the rails app, I get the following error:
Missing `secret_key_base` for 'production' environment, set this value in `config/secrets.yml`
What am I doing wrong?
Upvotes: 1
Views: 1395
Reputation: 589
You have set the secret_key_base
correctly in the secrets.yml file. The issue lies with the Ubuntu command you used, which created an ENV variable only for the bash session that you have started.
To make the setting permanent for interactive or not-interactive bash sessions you need to place the command:
export SECRET_KEY_BASE=adsfadfasdfasdfasdfasasdfasdfa
within a ~/.bashrc
file.
Then run:
source ~/.bashrc
to activate the file immediately. If you logout and login again you can check that your setting is still there with the command:
echo $SECRET_KEY_BASE
Upvotes: 2