dan
dan

Reputation: 121

Read custom heroku domain at runtime

Curious if anyone knows a way to access the output of heroku domains from an (Rails) app at runtime. I'd like a way to determine the preferred url of a site, programmatically and outside of the request-response cycle, without requiring additional config.

Upvotes: 0

Views: 66

Answers (2)

dan
dan

Reputation: 121

As mentioned by Thomas, it doesn't appear to be possible without the API. Solved my particular problem with a setting in the DB rather than an env var.

Upvotes: 0

Thomas Klemm
Thomas Klemm

Reputation: 10856

The Heroku API has an endpoint for getting and setting domains. You need your API key to authenticate, and this you should store once in your config environment (not inside the git repo).

Upvotes: 1

Related Questions