Search code examples
dockerdocker-composedockerfileopenapiquarkus

Quarkus application - add servers to the Open API specification in runtime (run in a Docker Container)


I'm currnently working on an application based on Quarkus that provides an Open API specification (thanks Quarkus Open API and Swagger extensions). I run application in a Docker container.

Initially I set a property quarkus.smallrye-openapi.servers to some default one but then I would like to set it in a runtime to the value of HOSTNAME system variable available in a Docker container.

How can I do it? In a Dockerfile?


Solution

  • The easiest way to do this is to add your own filter ( stage runtime) see https://quarkus.io/guides/openapi-swaggerui#enhancing-the-openapi-schema-with-filters

    Inside your filter you can lookup the env car ( just using micro profile config) and add a server to the open API object.