diff --git a/docs/config/defaults.md b/docs/config/defaults.md new file mode 100644 index 00000000..a17501d1 --- /dev/null +++ b/docs/config/defaults.md @@ -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` diff --git a/docs/config/index.md b/docs/config/index.md index cb5e7989..90f82338 100644 --- a/docs/config/index.md +++ b/docs/config/index.md @@ -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 @@ -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 @@ -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 @@ -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) diff --git a/docs/config/watch.md b/docs/config/watch.md index 0812ea66..b30fafa6 100644 --- a/docs/config/watch.md +++ b/docs/config/watch.md @@ -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 @@ -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` diff --git a/mkdocs.yml b/mkdocs.yml index 6bc638fb..e77d890a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -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