feat: provide HYSTERIA_ACME_DIR to control acme data directory

This commit is contained in:
Toby 2023-09-08 18:41:15 -07:00
parent 1abddbff19
commit 1f1b071ca8
2 changed files with 6 additions and 1 deletions

View File

@ -24,6 +24,7 @@ const (
appLogLevelEnv = "HYSTERIA_LOG_LEVEL" appLogLevelEnv = "HYSTERIA_LOG_LEVEL"
appLogFormatEnv = "HYSTERIA_LOG_FORMAT" appLogFormatEnv = "HYSTERIA_LOG_FORMAT"
appDisableUpdateCheckEnv = "HYSTERIA_DISABLE_UPDATE_CHECK" appDisableUpdateCheckEnv = "HYSTERIA_DISABLE_UPDATE_CHECK"
appACMEDirEnv = "HYSTERIA_ACME_DIR"
) )
var ( var (

View File

@ -232,7 +232,11 @@ func (c *serverConfig) fillTLSConfig(hyConfig *server.Config) error {
// ACME // ACME
dataDir := c.ACME.Dir dataDir := c.ACME.Dir
if dataDir == "" { if dataDir == "" {
dataDir = "acme" // If not specified in the config, check the environment variable
// before resorting to the default "acme" value. The main reason
// we have this is so that our setup script can set it to the
// user's home directory.
dataDir = envOrDefaultString(appACMEDirEnv, "acme")
} }
cmCfg := &certmagic.Config{ cmCfg := &certmagic.Config{
RenewalWindowRatio: certmagic.DefaultRenewalWindowRatio, RenewalWindowRatio: certmagic.DefaultRenewalWindowRatio,