Skip to content

Commit

Permalink
docs: move imageDefaults to defaults in config root
Browse files Browse the repository at this point in the history
  • Loading branch information
crazy-max committed Sep 23, 2023
1 parent 62e1750 commit 70b2f5c
Show file tree
Hide file tree
Showing 4 changed files with 152 additions and 34 deletions.
132 changes: 132 additions & 0 deletions docs/config/defaults.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Defaults configuration

## Overview

Defaults allow specifying default values for any configuration that is
typically set at the image level using labels or annotations depending on the
provider. Any of them will take precedence or be merged over defaults.

```yaml
defaults:
watchRepo: false
notifyOn:
- new
- update
maxTags: 10
sortTags: reverse
includeTags:
- latest
excludeTags:
- dev
metadata:
foo: bar
```
## Configuration
### `watchRepo`

Watch all tags of this container image ([be careful](../faq.md#docker-hub-rate-limits)
with this setting). (default `false`)

!!! example "Config file"
```yaml
defaults:
watchRepo: false
```

!!! abstract "Environment variables"
* `DIUN_DEFAULTS_WATCHREPO`

### `notifyOn`

List of status to be notified. Can be one of `new` or `update`.
(default `new,update`)

!!! example "Config file"
```yaml
defaults:
notifyOn:
- new
- update
```

!!! abstract "Environment variables"
* `DIUN_DEFAULTS_NOTIFYON=new,update`

### `maxTags`

Maximum number of tags to watch. `0` means all of them. (default `0`)

!!! warning
Only works if watch repo is enabled.

!!! example "Config file"
```yaml
defaults:
maxTags: 10
```

!!! abstract "Environment variables"
* `DIUN_DEFAULTS_MAXTAGS=10`

### `sortTags`

[Sort tags method](../faq.md#tags-sorting-when-using-watch_repo). Can be one of
`default`, `reverse`, `semver`, `lexicographical`. (default `reverse`)

!!! warning
Only works if watch repo is enabled.

!!! example "Config file"
```yaml
defaults:
sortTags: reverse
```

!!! abstract "Environment variables"
* `DIUN_DEFAULTS_SORTTAGS=reverse`

### `includeTags`

List of regular expressions to include tags. Can be useful if watch repo is
enabled.

!!! example "Config file"
```yaml
defaults:
includeTags:
- ^\d+\.\d+\.\d+$
```

!!! abstract "Environment variables"
* `DIUN_DEFAULTS_INCLUDETAGS=^\d+\.\d+\.\d+$`

### `excludeTags`

List of regular expressions to exclude tags. Can be useful if watch repo is
enabled.

!!! example "Config file"
```yaml
defaults:
excludeTags:
- dev
```

!!! abstract "Environment variables"
* `DIUN_DEFAULTS_EXCLUDETAGS=dev`

### `metadata`

Additional metadata that can be used in [notification template](../faq.md#notification-template)

!!! example "Config file"
```yaml
defaults:
metadata:
foo: bar
```

!!! abstract "Environment variables"
* `DIUN_DEFAULTS_METADATA_FOO=bar`
19 changes: 19 additions & 0 deletions docs/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ You can override this using the [`--config` flag or `CONFIG` env var with `serve
firstCheckNotif: false
runOnStartup: true

defaults:
watchRepo: false
notifyOn:
- new
- update
sortTags: reverse

notif:
amqp:
host: localhost
Expand Down Expand Up @@ -132,6 +139,13 @@ All configuration from file can be transposed into environment variables. As an
firstCheckNotif: false
runOnStartup: true

defaults:
watchRepo: false
notifyOn:
- new
- update
sortTags: reverse

notif:
gotify:
endpoint: http://gotify.foo.com
Expand Down Expand Up @@ -187,6 +201,10 @@ Can be transposed to:
DIUN_WATCH_FIRSTCHECKNOTIF=false
DIUN_WATCH_RUNONSTARTUP=true

DIUN_DEFAULTS_WATCHREPO=false
DIUN_DEFAULTS_NOTIFYON=new,update
DIUN_DEFAULTS_SORTTAGS=reverse

DIUN_NOTIF_GOTIFY_ENDPOINT=http://gotify.foo.com
DIUN_NOTIF_GOTIFY_TOKEN=Token123456
DIUN_NOTIF_GOTIFY_PRIORITY=1
Expand Down Expand Up @@ -224,6 +242,7 @@ Can be transposed to:

* [db](db.md)
* [watch](watch.md)
* [defaults](defaults.md)
* notif
* [amqp](../notif/amqp.md)
* [discord](../notif/discord.md)
Expand Down
34 changes: 0 additions & 34 deletions docs/config/watch.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@ watch:
healthchecks:
baseURL: https://hc-ping.com/
uuid: 5bf66975-d4c7-4bf5-bcc8-b8d8a82ea278
imageDefaults:
platform:
os: linux
arch: amd64
regopt: ""
notify_on: [new, update]
max_tags: 10
sort_tags: reverse
include_tags: [latest]
exclude_tags: [dev]
```
## Configuration
Expand Down Expand Up @@ -140,27 +130,3 @@ events to [healthchecks.io](https://healthchecks.io/).

* `baseURL`: Base URL for the Healthchecks Ping API (default `https://hc-ping.com/`).
* `uuid`: UUID of an existing healthcheck (required).

### `imageDefaults`

ImageDefaults allows specifying default values for any configuration that is typically set at an Image level. For details More details on these examples can be seen in the [file provider documentation](../providers/file.md). Any value sset at the Image level will override or be merged with any deault values.

!!! tip
Not all values must be provided. You may chose which ones you'd like to set. A an example may be to specify defaults such that new SemVer tags will be trigger notifications.

!!! tip
Most values will be strictly overwritten by Image level variables. The notable exception is `metadata`. There are several sources of metadata that can be provided. First, via `ImageDefaults`, second via the platform, and finally by the image. When these are merged, unique keys will always persist but values will be overwritten in the order previously described. Eg. default keys will be overwritten by provider metadata keys on collision.

!!! example "Config file" watching for new x.y.z semver tags
```yaml
watch:
imageDefaults:
watch_repo: true
sort_tags: semver
include_tags:
- "^\d+\.\d+\.\d+$"
!!! abstract "Environment variables"
* `DIUN_WATCH_IMAGE_DEFAULTS_WATCH_REPO`
* `DIUN_WATCH_IMAGE_DEFAULTS_SORT_TAGS`
* `DIUN_WATCH_IMAGE_DEFAULTS_INCLUDE_TAGS`
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ nav:
- Overview: config/index.md
- .db: config/db.md
- .watch: config/watch.md
- .defaults: config/defaults.md
- .notif: config/notif.md
- .regopts: config/regopts.md
- .providers: config/providers.md
Expand Down

0 comments on commit 70b2f5c

Please sign in to comment.