Where should I store development credentials on a Spring Boot project?

前端 未结 2 1266
既然无缘
既然无缘 2021-02-08 04:45

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

2条回答
  •  温柔的废话
    2021-02-08 05:10

    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
    

提交回复
热议问题