Skip to content

v0.2b-HideApiKey-patch

Choose a tag to compare

Changelog v0.2b-HideApiKey-patch

Merged Chooi Chin's pull request patch, environment variable app.api.key now works as intended. This was done today 19 Dec around 7pm.

Please follow Chooi Chin's steps in the post directly below

=== Files added or edited ===
README.md [edited]
.gitignore [edited]
application.properties [edited]

Chooi Chin's steps to set up environment variable app.api.key

Keep the .vscode folder as it is. No need to change anything.

Action:

In application.properties, put this in:

  spring.profiles.active=dev

Comment out the previous line by Jimmy :

#app.api.key=${MY_API_KEY}

Action:

Create a an application-dev.properties file in the same folder as the application.properties.

In the file, put this line:

app.api.key=<YOUR API KEY>

There is a main - resources - META-INF. Leave it as it is. No need to change anything.

Put this line in the .gitignore, so that the API key will not be uploaded to github.

/src/main/resources/application-dev.properties

Do a git status. You should not see any git tracking of the application-dev.properties.

That's all.
mvn spring-boot:run