Closed mattfbacon closed 1 year ago
It would be useful, but would be quite a bit of work. The mox config consists of two files: mox.conf and domains.conf. mox.conf is type Static in the config package, https://pkg.go.dev/github.com/mjl-/mox/config#Static. domains.conf is type Dynamic in the config package, https://pkg.go.dev/github.com/mjl-/mox/config#Dynamic. The first is called static because it doesn't change during the lifetime of a mox process (at the moment). The second is dynamic and each time it changes (on disk), it is reloaded (unless parsing the new version results in an error, then nothing changes). So, an explicit reload command isn't needed for reloading domains.conf (mox needs to reload the config itself when you add/remove/update an account/domain through the admin/account web interface or the cli "mox config ..." commands). If mox.conf changes, you must now restart mox. To make it possible to reload with restarting mox, we would have to make more of mox internals reloading. Like starting listeners. But also some TLS private key loading (other issue). It's doable, but quite a bit of work, requiring some refactoring.
But perhaps there are other options as well. Perhaps only some parts of mox.conf can be made reloadable. At some point it would be helpful (e.g. for upgrades) for mox to rewrite mox.conf itself too (after changes made through the web admin interface/cli commands). Mox never does that now.
I suppose a question is: which config file or setting would you like to dynamically reload? By the way, to force a reload of domains.conf, you could just run "touch" on the file. But it will (should) be an no-op.
It's doable, but quite a bit of work, requiring some refactoring.
OK, that was really the main question. In that case it's not that big of a deal and mox restarts fast enough that I'm not too worried about that. Just wanted to understand, because it seemed like certain commands on the CLI, such as config domain add
, reloaded the config, but I understand now that that is the dynamic configuration, and I was thinking specifically about static configuration.
I will look more closely at #77, though
This would be useful for
systemctl reload mox
. It seems that mox already supports reloading config, but doesn't expose a simple CLI function to just reload config without necessarily making any changes.