mirror of
https://github.com/crazy-max/diun.git
synced 2025-12-21 21:33:22 +01:00
Add env vars config example
This commit is contained in:
@@ -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,84 +17,164 @@ 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:
|
||||||
|
|
||||||
```yaml
|
??? example "diun.yml"
|
||||||
db:
|
```yaml
|
||||||
path: diun.db
|
db:
|
||||||
|
path: diun.db
|
||||||
|
|
||||||
watch:
|
watch:
|
||||||
workers: 10
|
workers: 10
|
||||||
schedule: "0 * * * *"
|
schedule: "0 * * * *"
|
||||||
firstCheckNotif: false
|
firstCheckNotif: false
|
||||||
|
|
||||||
notif:
|
notif:
|
||||||
amqp:
|
amqp:
|
||||||
host: localhost
|
host: localhost
|
||||||
port: 5672
|
port: 5672
|
||||||
username: guest
|
username: guest
|
||||||
password: guest
|
password: guest
|
||||||
queue: queue
|
queue: queue
|
||||||
gotify:
|
gotify:
|
||||||
endpoint: http://gotify.foo.com
|
endpoint: http://gotify.foo.com
|
||||||
token: Token123456
|
token: Token123456
|
||||||
priority: 1
|
priority: 1
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
mail:
|
mail:
|
||||||
host: localhost
|
host: localhost
|
||||||
port: 25
|
port: 25
|
||||||
ssl: false
|
ssl: false
|
||||||
insecureSkipVerify: false
|
insecureSkipVerify: false
|
||||||
from: diun@example.com
|
from: diun@example.com
|
||||||
to: webmaster@example.com
|
to: webmaster@example.com
|
||||||
rocketchat:
|
rocketchat:
|
||||||
endpoint: http://rocket.foo.com:3000
|
endpoint: http://rocket.foo.com:3000
|
||||||
channel: "#general"
|
channel: "#general"
|
||||||
userID: abcdEFGH012345678
|
userID: abcdEFGH012345678
|
||||||
token: Token123456
|
token: Token123456
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
script:
|
script:
|
||||||
cmd: "myprogram"
|
cmd: "myprogram"
|
||||||
args:
|
args:
|
||||||
- "--anarg"
|
- "--anarg"
|
||||||
- "another"
|
- "another"
|
||||||
slack:
|
slack:
|
||||||
webhookURL: https://hooks.slack.com/services/ABCD12EFG/HIJK34LMN/01234567890abcdefghij
|
webhookURL: https://hooks.slack.com/services/ABCD12EFG/HIJK34LMN/01234567890abcdefghij
|
||||||
teams:
|
teams:
|
||||||
webhookURL: https://outlook.office.com/webhook/ABCD12EFG/HIJK34LMN/01234567890abcdefghij
|
webhookURL: https://outlook.office.com/webhook/ABCD12EFG/HIJK34LMN/01234567890abcdefghij
|
||||||
telegram:
|
telegram:
|
||||||
token: aabbccdd:11223344
|
token: aabbccdd:11223344
|
||||||
chatIDs:
|
chatIDs:
|
||||||
- 123456789
|
- 123456789
|
||||||
- 987654321
|
- 987654321
|
||||||
webhook:
|
webhook:
|
||||||
endpoint: http://webhook.foo.com/sd54qad89azd5a
|
endpoint: http://webhook.foo.com/sd54qad89azd5a
|
||||||
method: GET
|
method: GET
|
||||||
headers:
|
headers:
|
||||||
content-type: application/json
|
content-type: application/json
|
||||||
authorization: Token123456
|
authorization: Token123456
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
|
|
||||||
regopts:
|
regopts:
|
||||||
someregistryoptions:
|
someregistryoptions:
|
||||||
username: foo
|
username: foo
|
||||||
password: bar
|
password: bar
|
||||||
timeout: 20s
|
timeout: 20s
|
||||||
onemore:
|
onemore:
|
||||||
username: foo2
|
username: foo2
|
||||||
password: bar2
|
password: bar2
|
||||||
insecureTLS: true
|
insecureTLS: true
|
||||||
|
|
||||||
providers:
|
providers:
|
||||||
docker:
|
docker:
|
||||||
watchStopped: true
|
watchStopped: true
|
||||||
swarm:
|
swarm:
|
||||||
watchByDefault: true
|
watchByDefault: true
|
||||||
kubernetes:
|
kubernetes:
|
||||||
namespaces:
|
namespaces:
|
||||||
- default
|
- default
|
||||||
- production
|
- production
|
||||||
file:
|
file:
|
||||||
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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user