Reputation: 2306
My objective is to understand how to include sensitive constants/secrets (eg. api token) and non-sensitive constants (eg. api route) in my code.
Example for a sensitive constant:
val apiToken = "Hushhhh!"
Example for a non-sensitive constant:
val happyUsersEndpoint = "https://happy.foo.io/v1/users"
My questions are:
To my understanding, there are ways to do that in Java-ish code, but I am mainly looking for ways that fit well into Scala code (if possible).
Upvotes: 1
Views: 150
Reputation: 850
It should not be in the source code and in the VCS repo.
It should be a part of the deployment/operation process.
You can use some sort of a config or retrieve it from env variables. Which is better depends on your stack. Is it a docker? Is it a Play or something from typelevel stack?
For each situation, there are would be a different appropriate method. For example:
Upvotes: 4