Skip to main content

Module config_watch

Module config_watch 

Source
Expand description

Reload when the config file or a certificate changes (watch = true, #10).

A background thread polls the size and modification time of rws.config.toml (or RWS_CONFIG_FILE) and of every configured TLS certificate and key once a second. A change that looks the same on two polls in a row — an editor or certbot finished writing — triggers the same validated reload as SIGHUP (crate::config_reload::request_reload): a broken config is rejected and the running one keeps serving. The set of files is re-read on every poll, so a reload that points at new certificates starts watching them. Off by default, like Caddy’s --watch.

Structs§

Watcher
Change detection, one Watcher::poll per interval.

Constants§

POLL_INTERVAL
How often the files are checked.
RWS_CONFIG_WATCH
RWS_CONFIG_WATCH: true to reload when a watched file changes.

Functions§

enabled
Whether RWS_CONFIG_WATCH is on.
start
Start the watcher thread when RWS_CONFIG_WATCH is on; the rws binary calls it after reading its configuration.
watched_paths
The files whose change means a reload: the config file and every configured certificate and key (the default pair and each virtual host’s).