Hello
We have a springboot application, and database settings are stored in an application.yml file.
This means database connection settings go into version control.
Goals
- Personally I would prefer if we use environment variables.
- If we use env vars, that the setup of these can be part of the project
- We are also looking for a way for each developer to have their own db settings - and that they are not committed to git
If we use environment variables, how can these env vars be setup when the container spins up?
Pom File
It is possible to set env vars in pom file, eg,
<env>
<HTTP_PORT>8080</HTTP_PORT>
<JAVA_APP_JAR>${project.artifactId}-${project.version}.war</JAVA_APP_JAR>
</env>
However, this has a few problems - values are still committed to git, and fmp does not allow null values.
And if the values are null, then the application will not start.
Deployment.yml
I see F8 has a deployment yml file which apparently allows env vars to be set, but I could not get it to work, probably due to incorrect indentation.
Any recommendations or advice on how best to solve this is appreciated.
Br
Anton