Add env vars config example

This commit is contained in:
CrazyMax
2020-06-20 05:25:59 +02:00
parent cbff8af5d6
commit 9d4fd998b5

View File

@@ -5,7 +5,7 @@
There are two different ways to define configuration in Diun: There are two different ways to define configuration in Diun:
* In a [configuration file](#configuration-file) * In a [configuration file](#configuration-file)
* As environment variables * As [environment variables](#environment-variables)
These ways are evaluated in the order listed above. These ways are evaluated in the order listed above.
@@ -17,6 +17,7 @@ For example, the `DIUN_PROVIDERS_DOCKER` environment variable is enough by itsel
You can define a configuration file through the option `--config` with the following content: You can define a configuration file through the option `--config` with the following content:
??? example "diun.yml"
```yaml ```yaml
db: db:
path: diun.db path: diun.db
@@ -96,6 +97,85 @@ providers:
directory: ./imagesdir directory: ./imagesdir
``` ```
## Environment variables
All configuration from file can be transposed into environment variables. As an example, the following configuration:
??? example "diun.yml"
```yaml
db:
path: diun.db
watch:
workers: 10
schedule: "0 * * * *"
firstCheckNotif: false
notif:
gotify:
endpoint: http://gotify.foo.com
token: Token123456
priority: 1
timeout: 10s
telegram:
token: aabbccdd:11223344
chatIDs:
- 123456789
- 987654321
webhook:
endpoint: http://webhook.foo.com/sd54qad89azd5a
method: GET
headers:
content-type: application/json
authorization: Token123456
timeout: 10s
regopts:
someregistryoptions:
username: foo
password: bar
timeout: 20s
providers:
kubernetes:
tlsInsecure: false
namespaces:
- default
- production
```
Can be transposed to:
??? example "environment variables"
```
DIUN_DB_PATH=diun.db
DIUN_WATCH_WORKERS=10
DIUN_WATCH_SCHEDULE=0 * * * *
DIUN_WATCH_FIRSTCHECKNOTIF=false
DIUN_NOTIF_GOTIFY_ENDPOINT=http://gotify.foo.com
DIUN_NOTIF_GOTIFY_TOKEN=Token123456
DIUN_NOTIF_GOTIFY_PRIORITY=1
DIUN_NOTIF_GOTIFY_TIMEOUT=10s
DIUN_NOTIF_TELEGRAM_TOKEN=aabbccdd:11223344
DIUN_NOTIF_TELEGRAM_CHATIDS=123456789,987654321
DIUN_NOTIF_WEBHOOK_ENDPOINT=http://webhook.foo.com/sd54qad89azd5a
DIUN_NOTIF_WEBHOOK_METHOD=GET
DIUN_NOTIF_WEBHOOK_HEADERS_CONTENT-TYPE=application/json
DIUN_NOTIF_WEBHOOK_HEADERS_AUTHORIZATION=Token123456
DIUN_NOTIF_WEBHOOK_TIMEOUT=10s
DIUN_REGOPTS_SOMEREGISTRYOPTIONS_USERNAME=foo
DIUN_REGOPTS_SOMEREGISTRYOPTIONS_PASSWORD=bar
DIUN_REGOPTS_SOMEREGISTRYOPTIONS_TIMEOUT=20s
PROVIDERS_KUBERNETES_TLSINSECURE=false
PROVIDERS_KUBERNETES_NAMESPACES=default,production
```
## Reference ## Reference
* [db](db.md) * [db](db.md)