Currently the only place Caddy will save its data is in $HOME, would be nice if this can be customized (by other means than changing the user's home directory), e.g. with a flag.
Also, if/when you do implement this, please don't treat the directories within like hidden files when this option is provided, e.g. instead of this:
/var/lib/caddy
โโโ .config/
โย ย โโโ caddy/
โย ย โโโ autosave.json
โโโ .local/
ย ย โโโ share/
ย ย โโโ caddy/
ย ย โโโ acme/
ย ย โโโ certificates/
ย ย โโโ locks/
ย ย โโโ ocsp/
then this:
/var/lib/caddy
โโโ autosave.json
โโโ acme/
โโโ certificates/
โโโ locks/
โโโ ocsp/
The current implementation is understandable when it's being run as a user, but not as a service by the system, as it mostly is.
(Extra awesome if this could make it to 2.1 ๐)
Figured it's _kind of_ possible by setting both XDG_CONFIG_HOME and XDG_DATA_HOME to /var/lib, but that's not a good solution.
Thanks for the question. You can change Caddy's storage to _anything_, any folder on your disk, or even a database or any other backend storage module, with or without environment variables: https://caddyserver.com/docs/json/storage/
This has been configurable since the very beginning.
I fail to see how to use this, could you elaborate with an example?
Just like the docs show, verbatim:
{
"storage": {
"module": "file_system",
"root": "/foo/bar"
}
}
Any further questions about how to use Caddy should go on our forums: https://caddy.community
For anyone finding this in the future, this is how you configure this in a Caddyfile:
{
storage file_system {
root /var/lib/caddy
}
}
# rest of your Caddyfile
The autosave.json file will still be using $HOME though.
For anyone finding this in the future, this is how you configure this in a Caddyfile:
{ storage file_system { root /var/lib/caddy } } # rest of your CaddyfileThe autosave.json file will still be using $HOME though.
Correction, Caddy adheres to the XDG convention and uses XDG_DATA_HOME, not necessarily $HOME.