I have an API key which I've saved to /home/user/api/keys
that I would like to save as a global variable in my Rails app. I thought this would work, this is my config/initializers/my_constants.rb
:
`source "/home/user/api/keys"`
API_PASS = ENV["API_PASSWORD"]
And this is /home/user/api/keys
(without the real value, obviously):
#!/bin/bash
export API_PASSWORD="--------"
The source command doesn't seem to do anything. API_PASS is just set to nil. How can I do this?