This repository was archived by the owner on May 27, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 27
Managing secrets
danecreekphotography edited this page Nov 6, 2020
·
1 revision
A security best practice is to keep sensitive information, commonly called "secrets", out of configuration files. These secrets are mainly passwords or tokens, but you may use them for other information you may consider sensitive like ip addresses, URIs, etc.
This project supports separating secrets from configuration files through the use of a secrets.json file. The file contains a list of key/value pairs which can then be referred to in the secrets.json and triggers.json file via mustache templates.
Here is an example of how to use it:
- Add a reference to your
secrets.jsonfile by adding to the docker-compose.yamlsecretshere:
secrets:
# This should point to the location of the secrets.json configuration file
file: ./secrets.json
- Add a reference to your newly added secret file by adding to the docker-compose container's
secretshere:
- secrets
- Modify your
settings.jsonortriggers.jsonfile to use values from the secrets file. The value inside the double curly-brace ({{}}) is the secret's key and will be replaced with the secret's value fromsecrets.json.
{
"deepstackUri": "http://deepstack-ai:5000/",
"enableAnnotations": false,
"enableWebServer": false,
"verbose": true,
"awaitWriteFinish": false,
"mqtt": {
"uri": "mqtt://mqtt:1883",
"username": "{{mqttUsername}}",
"password": "{{mqttPassword}}",
"enabled": false
},
"telegram": {
"botToken": "{{telegramBotToken}}",
"enabled": false
},
"pushbullet": {
"accessToken": "{{pushbulletAccessToken}}",
"enabled": false
},
"pushover": {
"apiKey": "{{pushoverApiKey}}",
"userKey": "{{pushoverUserKey}}",
"enabled": false
}
}- Add a
secrets.jsonfile, which will be used for mustache templating insettings.json. The string value on the left, "mqttUsername" for example, is the secret's key. The string value on the right, "mqttPassword" for example, is the secret's value.
{
"mqttUsername": "user",
"mqttPassword": "pass",
"telegramBotToken": "insert bot token here",
"pushbulletAccessToken": "access token here",
"pushoverApiKey": "api key here",
"pushoverUserKey": "user key here"
}- Add a
.gitignorethat excludessecrets.json. This prevents the file from getting submitted to git.
secrets.json