Search code examples
ruby-on-railsenvironment-variablesubuntu-14.04ubuntu-serversecret-key

Setting SECRET KEY env variables with Ubuntu server terminal no GUI


I have looked around and did not find any good tutorials on how to set the SECRET KEY environment variable on a server running Ubuntu Server with no gui. You can't copy or paste in the terminal so running rake secret is essentially useless.

I'm not sure if you can't paste in the terminal or if this has something to do with VMware console screen, because I know I can't paste values into any server when using the VMware console.

Looking for some guidance on setting these SECRET env variables


Solution

  • You'll probably want to set it in your .profile file. See https://help.ubuntu.com/community/EnvironmentVariables under Persistent environment variables for more information.

    There's also the figaro gem(https://github.com/laserlemon/figaro) that lets you set app-specific ENV variables through a YML file. This is a good idea if you need to host several apps on one server and under one user, but you should put the application.yml file containing your sensitive data into your .gitignore file.