apisio/apisio — pull request #2 by benatkin (2012-03-19 03:15:57+00:00)
Title: Omniauth environment variables

To log into my local dev instance I needed to change the GitHub OAuth Application used so it would redirect to my local dev instance. I saw that they're hardcoded in `config/initializers/omniauth.rb`. Besides having to change the contents of the repo to override it, this makes the keys public. This is OK in this case, it seems, because to get a token it needs to redirect to apis.io, but this takes a moment to realize. It's more proper if they're private.

For things to be private on heroku the most common way is environment variables. I'm using them locally, too. I run `source ~/dotfiles/config/apisio` which has my GitHub application `apisio-benatkin-dev` which redirects to `localhost:3000`. I find this works pretty well. I can also put these in `.rvmrc` which I don't commit.

In order to use this change you'll need to:

* delete the [GitHub OAuth App](https://github.com/settings/applications) and create a new one since the key's been exposed to the public
* run `heroku config` as in [the updated omniauth.rb](https://github.com/benatkin/apisio/blob/omniauth-environment-variables/config/initializers/omniauth.rb)
* push up the new code

Cheers!

Ben