f: typo fix

This commit is contained in:
AJ ONeal 2022-06-05 03:53:13 -06:00
parent 2e13cda6dd
commit b596338670
Signed by: coolaj86
GPG Key ID: 585419CA6DB0AA23
1 changed files with 9 additions and 10 deletions

View File

@ -15,6 +15,7 @@ const (
tmpBase = "acme-tmp"
)
// Provider is the default Challenge Solver Provider
var Provider Solver
// Solver implements the challenge.Provider interface.
@ -24,14 +25,13 @@ type Solver struct {
// Present creates a HTTP-01 Challenge Token
func (s *Solver) Present(ctx context.Context, ch acme.Challenge) error {
log.Println("Present HTTP-01 challenge solution for", ch.Identifier.Value)
log.Println("Present HTTP-01 (fs) challenge solution for", ch.Identifier.Value)
myBase := s.Path
if 0 == len(tmpBase) {
myBase = "acme-tmp"
if 0 == len(s.Path) {
s.Path = tmpBase
}
challengeBase := filepath.Join(myBase, ch.Identifier.Value, ".well-known/acme-challenge")
challengeBase := filepath.Join(s.Path, ch.Identifier.Value, challengeDir)
_ = os.MkdirAll(challengeBase, 0700)
tokenPath := filepath.Join(challengeBase, ch.Token)
return ioutil.WriteFile(tokenPath, []byte(ch.KeyAuthorization), 0600)
@ -39,15 +39,14 @@ func (s *Solver) Present(ctx context.Context, ch acme.Challenge) error {
// CleanUp deletes an HTTP-01 Challenge Token
func (s *Solver) CleanUp(ctx context.Context, ch acme.Challenge) error {
log.Println("CleanUp HTTP-01 challenge solution for", ch.Identifier.Value)
log.Println("CleanUp HTTP-01 (fs) challenge solution for", ch.Identifier.Value)
myBase := s.Path
if 0 == len(tmpBase) {
myBase = "acme-tmp"
if 0 == len(s.Path) {
s.Path = tmpBase
}
// always try to remove, as there's no harm
tokenPath := filepath.Join(myBase, ch.Identifier.Value, challengeDir, ch.Token)
tokenPath := filepath.Join(s.Path, ch.Identifier.Value, challengeDir, ch.Token)
_ = os.Remove(tokenPath)
return nil