Heroku in Heroku
As I build out these sites I had to run heroku commands on heroku since the admin site needs to setup Domains and Subdomain on each new site. I was glad they had the https://github.com/heroku/heroku.rb gem that made it possible to make an interface for administrators to add domains and subdomains to their heroku site.
In my controller I included the heroku-api as the node on the github page.
After that, on an update or a create I check if the domain exists.
There was another post on github in the issue queue to help me figure out how to rescue out of an error. Ideally though I would direct the user back to the edit page with an error message or autocomplete as they type. But right now I save their settings to the Partner model and show the error.
This allows me to use the "heroku domain:add --app APPNAME domain_name" command from within the app.
Setting up the ENV variables are explained on setting up heroku pages like this one https://devcenter.heroku.com/articles/config-vars so you can do this at the command line and note store it in a file on git.
comments powered by Disqus