-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Heroku Review Apps #214
Conversation
A good chunk of experimentation happened over in #201. Here's what it looks like so far: |
💥 https://huboard-rails-pr-214.herokuapp.com/ will now round-trip auth through https://huboard-rails.herokuapp.com/. Code is all in one file for hackability, but would welcome guidance on how best to structure it relative to the existing app. And general feedback, of course. |
👏 |
Heroku sets APP_NAME and PARENT_APP_NAME environment variables. The latter needs to replace the former in the OAuth redirect hostname, and the former needs to be appended as a query parameter to use on return. Env: HEROKU_APP_NAME = hb-pr-123 HEROKU_PARENT_APP_NAME = hb Input: https://hb-pr-123.herokuapp.com/ Output: https://hb.herokuapp.com/?APP_NAME=hb-pr-123
3b52cfa
to
a46cffd
Compare
For reference, when you auth from a PR build you should see the Warden Override in the logs (e.g.
And then on the parent side (e.g.
Looking again at the logs, I'm going to suppress the |
@discorick raised a good point offline - the |
Closes #183. As discussed, due to OAuth host constraints this isn't as trivial as it would be for a simple app.
Add
app.json
review app config, mostly generated by Heroku.I did manually add
HEROKU_PARENT_APP_NAME
, which I wish they had included in the generated file. It took me a long time to figure out thatapp.json
only matters when a review app is first created - this second commit didn't take effect until I deleted the existing review app. Much time wasted here.Override
Warden::GitHub::Config.normalized_uri()
to do two things:host
with the parent app name instead of the current app name.APP_NAME
query string with the current app name, so we can redirect back to it.UpdateAdd middleware to check forLoginController
APP_NAME
so we can redirect to review apps from the parent app as necessary.