I'm currently trying to dynamically add server URL's to my swagger documentation. I have the following code:
# spec/swagger_helper.rb
servers: [
{
url: 'https://{defaultHost}',
variables: {
defaultHost: {
default: Rails.application.credentials.hostname
}
}
}
]
To ensure that swagger gets generated for every heroku environment I have added a release command in my Procfile:
release: bundle exec rake rswag
I am still getting defaultHost as localhost:3000 in the heroku instance of the API documentation.
I think that Heroku doesn't let you generate the swagger.yml on production. You have to run the rake rswag locally and then push that change to Heroku.