In my organization we use Quarkus-based microservices. We usually create a container from the main branch and deploy it in dev,qa, and prod.
To target these environments, we have different profiles. We also make use of environment variables to keep things configurable as per the 12 factor app methodology.
Now I am faced with an confusion regarding best practices.
To elaborate further, please consider the below example.
OrderService has 2 configurable parameters.
app.db.conn
app.web.port
My application.properties looks like this.
app.db.conn:${DB_CONN}
app.web.port:${WEB_PORT}
Now I have 3 environments to deploy this app to. However, I can just run the application and supply the env parameters. This makes my application-dev.properties, application-qa.properties, and application-prod.properties look empty as I will not hard code values directly inside these environment specific properties.
My question is what the best practise regarding properties file in light of 12 factor app / env-based configurable properties?
Is it okay to just run the application in dev/qa/prod profile and supply env variables and have empty application-.properties file? Or get rid of the convention of env specific application properties files altogether.
Currently I have application.properties, application-.properties in my project. The profile based properties look useless and are just repeating what is present in the application.properties file.
Developers usually think of 'their' environment, which often boils down to the local machine where they run the code most often. It makes sense to configure suitable values as defaults. Or you can omit defaults and thus also force developers to provide that information at runtime.
However in operations it will be necessary to override these values to make the application run in different environments. Default values do not matter as long as they can be changed.
Whether you do that override with different properties files or environment variables or command line parameters or ... can still be debated.