From aa0638903a083e7e037b91831795369350002dc6 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 5 Dec 2021 23:56:06 +0100 Subject: [PATCH] fix argument check and some nits --- cmd/main.go | 6 ++++-- html/error.go | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index a1bee6a..cd1a1c2 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -49,7 +49,7 @@ func Serve(ctx *cli.Context) error { acmeEabKID := ctx.String("acme-eab-kid") acmeEabHmac := ctx.String("acme-eab-hmac") 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") } @@ -109,7 +109,9 @@ func Serve(ctx *cli.Context) error { 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 certMaintainCtx, cancelCertMaintain := context.WithCancel(context.Background()) diff --git a/html/error.go b/html/error.go index f831443..325dada 100644 --- a/html/error.go +++ b/html/error.go @@ -2,8 +2,9 @@ package html import ( "bytes" - "github.com/valyala/fasthttp" "strconv" + + "github.com/valyala/fasthttp" ) // ReturnErrorPage sets the response status code and writes NotFoundPage to the response body, with "%status" replaced