Setting Environment Variables

22 views
Skip to first unread message

bparanj

unread,
Aug 16, 2014, 5:02:47 PM8/16/14
to railsmachin...@googlegroups.com
I defined SECRET_KEY_BASE for Rails 4.1 in the rails ~/.profile file. When I deploy, I see error in the Apache log that it does not find value for secret_key_base. I have secrets.yml that defines secret_key_base=  <%= ENV['SECRET_KEY_BASE']. If I go to rails console in production I can see the value for ENV['SECRET_KEY_BASE']. Typing env in the command line also shows the value for the SECRET_KEY_BASE. How do I define the environment variable properly?

bparanj

unread,
Aug 16, 2014, 5:08:28 PM8/16/14
to railsmachin...@googlegroups.com
Never mind. I was assuming secrets.yml was getting updated on the server whenever I did cap deploy. Moonshine is not copying the secrets.yml file on every deploy. It looks like it does it only one first time deploy.

Kevin Lawver

unread,
Aug 16, 2014, 5:08:34 PM8/16/14
to railsmachin...@googlegroups.com
Check out the dotenv and dotenv-deployment gems. 

The other option is to have moonshine manage a file in /etc/defaults as shared_config to the values are available to all users (apache and rails). 


On Aug 16, 2014, at 17:02, bparanj <bpa...@gmail.com> wrote:

I defined SECRET_KEY_BASE for Rails 4.1 in the rails ~/.profile file. When I deploy, I see error in the Apache log that it does not find value for secret_key_base. I have secrets.yml that defines secret_key_base=  <%= ENV['SECRET_KEY_BASE']. If I go to rails console in production I can see the value for ENV['SECRET_KEY_BASE']. Typing env in the command line also shows the value for the SECRET_KEY_BASE. How do I define the environment variable properly?

--
You received this message because you are subscribed to the Google Groups "Moonshine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to railsmachine-moon...@googlegroups.com.
To post to this group, send email to railsmachin...@googlegroups.com.
Visit this group at http://groups.google.com/group/railsmachine-moonshine.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages