Rails config.hosts
Hello, I tried to add this to config/environments/production.rb:
But I'm still getting an error on https://rails-production-b7c8.up.railway.app/
I don't want to hard code in the Railway host which is why I tried the provided Railway domain.
13 Replies
Project ID:
467582c5-6f4d-4ae0-a734-6605d39f5edc
Project ID: 467582c5-6f4d-4ae0-a734-6605d39f5edc
are you building with dockerfile?
I used the Railway template via the website https://github.com/railwayapp-templates/ruby-rails
can you print out the value of that environment variable just as a sanity check?
Thanks for the help. I tried
railway run bash
and printenv
shows it as the expected value RAILWAY_PUBLIC_DOMAIN=rails-production-b7c8.up.railway.app
but I can't run rails c
to confirm it in the Rails app env.print it out from within your code on railway please
I don't know how to do that
it's runtime code though isn't it?
this is the code being deployed though https://github.com/paulmwatson/railsway/blob/main/config/environments/production.rb#L5
you arent aware of a way to log a value?
I can do that yes, hoping to fix this without a redeploy to log values though. I'll check now.
hah I added
logger.debug "config.hosts: #{config.hosts}"
but nothing new appeared in Observability, just the same [ActionDispatch::HostAuthorization::DefaultResponseApp] Blocked host: rails-production-b7c8.up.railway.app
. I'll park this for now and come back at it tomorrow. Thanks Brody.can you log the
RAILWAY_PUBLIC_DOMAIN
env var?I added
logger.info "ENV['RAILWAY_PUBLIC_DOMAIN']: #{ENV['RAILWAY_PUBLIC_DOMAIN']}"
but still nothing appearing in logsare you writing to stdout without a buffer?