validate - Validate Configuration
The validate command checks your Update-Watcher configuration file for correctness. It verifies YAML syntax, required fields, valid checker and notifier types, and option value types. This is useful after manually editing the config file or before deploying a new configuration to a server.
Usage
update-watcher validateThe validate command uses the same config file resolution as all other commands: it checks the --config flag first, then the default search paths (/etc/update-watcher/config.yaml, ~/.config/update-watcher/config.yaml, ./config.yaml).
What Is Validated
The validator checks the following:
YAML Syntax
The file must be valid YAML. Common syntax errors include incorrect indentation, missing colons, and unescaped special characters.
Required Fields
- The
watcherssection must exist and contain at least one watcher entry. - Each watcher entry must have a
typefield. - Notifier entries that require credentials (e.g., Slack webhook URL, Telegram bot token) are checked for the presence of those fields.
Valid Types
- Watcher
typevalues must be one of the 14 supported checker types:apt,dnf,pacman,zypper,apk,macos,homebrew,snap,flatpak,docker,distro,openclaw,wordpress,webproject. - Notifier
typevalues must be one of the 16 supported notifier types.
Option Types
- Boolean options (like
security_only,use_sudo) must be boolean values, not strings. - String options (like
webhook_url,path) must be strings. - The
send_policysetting must be either"only-on-updates"or"always".
Output
Valid Configuration
$ update-watcher validate
Configuration is valid.Invalid Configuration
$ update-watcher validate
Configuration errors found:
watchers[0]: unknown type "atp" (did you mean "apt"?)
watchers[1].options.security_only: expected bool, got string "yes"
notifiers[0].options: missing required field "webhook_url" for type "slack"Each error message indicates the location in the config file and a description of the problem.
Examples
Validate the Default Config File
update-watcher validateValidate a Specific Config File
update-watcher validate --config /path/to/config.yamlValidate Before Deployment
A common pattern is to validate a config file before copying it to a production server:
update-watcher validate --config ./staging-config.yaml && \
scp ./staging-config.yaml server:/etc/update-watcher/config.yamlValidate in CI/CD
update-watcher validate --config ./config.yaml
if [ $? -ne 0 ]; then
echo "Config validation failed"
exit 1
fiExit Codes
| Code | Meaning |
|---|---|
| 0 | Configuration is valid. |
| 4 | Configuration errors were found. |
Related
- status – View the resolved configuration.
- Configuration – Full YAML configuration reference.
- setup – Interactive wizard for creating valid configurations.