We have a dropwizard microservice which accesses a MySQL database. We currently stored encrypted credentials for database access in a configuration file (env.properties) so that it can be changed at deploy time by an ansible script per environment.
The encryption key is something we need to decrypt the credentials, and there is some debate about how to store it. Some options:
- Store the key in the config file. The key is environment specific as well, and because we are deploying the code with ansible, the credentials and keys will not be stored in the microservice repository. The downside here is that the encrypted password is stored in the same file as the key to decrypt it.
- Store the key in a startup script, which loads the value into environment variables. Ops didn't like this because they would have to manage two files. currently they only want to manage a single environment properties file. This is understandable because we have enough issues managing the one file, as it is.
What is the best practice for managing this decryption key?