It cannot be used to trigger a config reload whenever a there is a file change
This can screw up developer experience in dev environments where changes in config will be expected to reflect immediately
How can we solve it?
Create a new ConfigLoader manager which will run outside the scope of caddy in a separate goroutine.
The configloader's operation will be started before caddy.
The config loader can have multiple adapters Adapters will watch for config changes in a specific env. For e.g: File / K8s adapters.
Each adapter, upon successful initialization which return a channel of []byte which is nothing but the caddy config in JSON. The ConfigLoader will watch this channel in a for-range loop and call caddy.Load after a debounce.
Debounce Logic:
Wait for 500 milliseconds whenever a change is received on the channel before running `caddy.Load'
The interval restarts if another config was received before the interval elapses.
The debounce interval is configurable via the --config.debouce-interval flag
We will start with migrating the existing file configloader to this new mechanism.
If you want this feature to be implemented, give it a thumbs up reaction, so that we can determine which features are important to you.
👍
The problem faced currently?
How can we solve it?
ConfigLoader
manager which will run outside the scope of caddy in a separate goroutine.adapters
Adapters will watch for config changes in a specific env. For e.g: File / K8s adapters.[]byte
which is nothing but the caddy config in JSON. TheConfigLoader
will watch this channel in a for-range loop and callcaddy.Load
after a debounce.--config.debouce-interval
flagWe will start with migrating the existing
file
configloader to this new mechanism.