Make ACME cache directory location configurable (#81)

* Remove trailing whitespace from README and config

* Make ACME cache directory location configurable
This commit is contained in:
Andrew Meyer
2018-05-14 05:42:39 -05:00
committed by Joona Hoikkala
parent fde566fe67
commit 3006cb712b
4 changed files with 20 additions and 15 deletions

View File

@ -243,6 +243,8 @@ tls = "none"
# only used if tls = "cert"
tls_cert_privkey = "/etc/tls/example.org/privkey.pem"
tls_cert_fullchain = "/etc/tls/example.org/fullchain.pem"
# only used if tls = "letsencrypt"
acme_cache_dir = "api-certs"
# CORS AllowOrigins, wildcards can be used
corsorigins = [
"*"

View File

@ -47,6 +47,8 @@ tls = "none"
# only used if tls = "cert"
tls_cert_privkey = "/etc/tls/example.org/privkey.pem"
tls_cert_fullchain = "/etc/tls/example.org/fullchain.pem"
# only used if tls = "letsencrypt"
acme_cache_dir = "api-certs"
# CORS AllowOrigins, wildcards can be used
corsorigins = [
"*"

View File

@ -81,7 +81,7 @@ func startHTTPAPI() {
switch Config.API.TLS {
case "letsencrypt":
m := autocert.Manager{
Cache: autocert.DirCache("api-certs"),
Cache: autocert.DirCache(Config.API.ACMECacheDir),
Prompt: autocert.AcceptTOS,
HostPolicy: autocert.HostWhitelist(Config.API.Domain),
}

View File

@ -58,6 +58,7 @@ type httpapi struct {
TLS string
TLSCertPrivkey string `toml:"tls_cert_privkey"`
TLSCertFullchain string `toml:"tls_cert_fullchain"`
ACMECacheDir string `toml:"acme_cache_dir"`
CorsOrigins []string
UseHeader bool `toml:"use_header"`
HeaderName string `toml:"header_name"`