1

In my Rails app I want to use the Twitter gem for accessing the Twitter API. I'm storing the OAuth secrets in a file under config/initializers/twitter.rb Since I want to put the code in a public repository on Github my first reaction was to incude the file in gitignore. However, this solution does not work with hosting on Heroku, which requires a git repository that includes the secrets.

2
  • Did you consider using environment variables? Jun 14, 2013 at 8:52
  • not yet, I will look into it! Jun 14, 2013 at 9:42

1 Answer 1

2

Loading the OAuth secrets from environment variables using something like Dotenv (https://github.com/bkeepers/dotenv) would allow you to set and use them locally and in Heroku without having to store them in a file. See https://devcenter.heroku.com/articles/config-vars for setting env variables in Heroku.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.