Where should I store development credentials on a Spring Boot project so that they are not committed to the repository? What\'s the most standard way?
In other framework
Spring-boot allows you to externalize your configuration in different places. For the scenario in question, one could place an application.properties
file under ${PROJECT_ROOT}/config/
.
Those properties will override any other defined properties.
In this case, it is not packaged within a deployable artifact.
Take a look at Application property files for further details.
Provide a sample configuration file under config/application.properties.example
as a good starting point. That file could be version controlled.
To avoid unintentional commits ignore everything else.
Using git
, an ignore file could contain the following snippet (ignores everything but files ending with .example
and a README.md
):
.gitignore:
/config/*
!/config/README.md
!/config/*.example