fix argument check and some nits

This commit is contained in:
6543 2021-12-05 23:56:06 +01:00
parent 196482da07
commit aa0638903a
No known key found for this signature in database
GPG key ID: C99B82E40B027BAE
2 changed files with 6 additions and 3 deletions

View file

@ -49,7 +49,7 @@ func Serve(ctx *cli.Context) error {
acmeEabKID := ctx.String("acme-eab-kid") acmeEabKID := ctx.String("acme-eab-kid")
acmeEabHmac := ctx.String("acme-eab-hmac") acmeEabHmac := ctx.String("acme-eab-hmac")
dnsProvider := ctx.String("dns-provider") dnsProvider := ctx.String("dns-provider")
if acmeAcceptTerms || (dnsProvider == "" && acmeAPI != "https://acme.mock.directory") { if (!acmeAcceptTerms || dnsProvider == "") && acmeAPI != "https://acme.mock.directory" {
return errors.New("you must set $ACME_ACCEPT_TERMS and $DNS_PROVIDER, unless $ACME_API is set to https://acme.mock.directory") return errors.New("you must set $ACME_ACCEPT_TERMS and $DNS_PROVIDER, unless $ACME_API is set to https://acme.mock.directory")
} }
@ -109,7 +109,9 @@ func Serve(ctx *cli.Context) error {
return err return err
} }
certificates.SetupCertificates(mainDomainSuffix, dnsProvider, acmeConfig, acmeUseRateLimits, enableHTTPServer, challengeCache, certDB) if err := certificates.SetupCertificates(mainDomainSuffix, dnsProvider, acmeConfig, acmeUseRateLimits, enableHTTPServer, challengeCache, certDB); err != nil {
return err
}
interval := 12 * time.Hour interval := 12 * time.Hour
certMaintainCtx, cancelCertMaintain := context.WithCancel(context.Background()) certMaintainCtx, cancelCertMaintain := context.WithCancel(context.Background())

View file

@ -2,8 +2,9 @@ package html
import ( import (
"bytes" "bytes"
"github.com/valyala/fasthttp"
"strconv" "strconv"
"github.com/valyala/fasthttp"
) )
// ReturnErrorPage sets the response status code and writes NotFoundPage to the response body, with "%status" replaced // ReturnErrorPage sets the response status code and writes NotFoundPage to the response body, with "%status" replaced