I want to get my app's hostname on Heroku.

Asked 2 years ago, Updated 2 years ago, 84 views

I am using Review.app in Rails in Heroku (the one that has an environment for each PR)

I need to set the host name in the email settings as follows. Is there any way to know the host name, such as the name of the current application?

Rails.application.configured do
  config.action_mailer.default_url_options={ host:'localhost', port:3000}
end

I don't think I can get it from the environment variables.

ruby-on-rails heroku

2022-09-30 21:15

1 Answers

Self-resolved, now app.json can take it from the environment variables below.

{
  "name": "foo",
  "scripts": {
    "postdeploy": "rakedb:setup"
  },
  "env": {
    "HEROKU_APP_NAME": { "required": true},
  }
}


2022-09-30 21:15

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.