|
|
|
#### Issue
|
|
|
|
|
|
|
|
*To avoid future commits containing critical credentials or wrongly replacing properties with ones used locally, it would be useful to have an additional local configuration file that overwrites the configurations of application-[dev | prod | staging].yml when Gitserach is started.*
|
|
|
|
|
|
|
|
[See Artemis implementation](https://docs.artemis.ase.in.tum.de/dev/setup/?highlight=application%2dlocal%2eyml)
|
|
|
|
|
|
|
|
#### Solution
|
|
|
|
|
|
|
|
This can be solved by using an additional `local` Spring profile when starting Gitsearch. Appending this new profile at the end of the profile list ensures that other configuration documents are overwritten. (See [Spring Boot multi-document docs](https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config.files.multi-document))
|
|
|
|
|
|
|
|
In order for this to work you should create a new `src/main/resources/config/application-local.yml` file and insert the YAML values you want to overwrite (i.e. passwords/secrets, URLs, ..) and start Gitsearch with the additional `local` profile.
|
|
|
|
|
|
|
|
#### Example
|
|
|
|
|
|
|
|
If you don't want to share the `spring.datasource.password` in the git repository, replace this property with an empty or dummy value in `application-prod.yml` and add the real value in `application-local.yml` following the same YAML structure:
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
spring:
|
|
|
|
datasource:
|
|
|
|
password: <value>
|
|
|
|
```
|
|
|
|
You can now start the Gitsearch application using the `-Dspring.profiles.active=prod,local` parameter to start using the new local config. |