f: typo fix
This commit is contained in:
parent
2e13cda6dd
commit
b596338670
|
@ -15,6 +15,7 @@ const (
|
||||||
tmpBase = "acme-tmp"
|
tmpBase = "acme-tmp"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Provider is the default Challenge Solver Provider
|
||||||
var Provider Solver
|
var Provider Solver
|
||||||
|
|
||||||
// Solver implements the challenge.Provider interface.
|
// Solver implements the challenge.Provider interface.
|
||||||
|
@ -24,14 +25,13 @@ type Solver struct {
|
||||||
|
|
||||||
// Present creates a HTTP-01 Challenge Token
|
// Present creates a HTTP-01 Challenge Token
|
||||||
func (s *Solver) Present(ctx context.Context, ch acme.Challenge) error {
|
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(s.Path) {
|
||||||
if 0 == len(tmpBase) {
|
s.Path = tmpBase
|
||||||
myBase = "acme-tmp"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
challengeBase := filepath.Join(myBase, ch.Identifier.Value, ".well-known/acme-challenge")
|
challengeBase := filepath.Join(s.Path, ch.Identifier.Value, challengeDir)
|
||||||
_ = os.MkdirAll(challengeBase, 0700)
|
_ = os.MkdirAll(challengeBase, 0700)
|
||||||
tokenPath := filepath.Join(challengeBase, ch.Token)
|
tokenPath := filepath.Join(challengeBase, ch.Token)
|
||||||
return ioutil.WriteFile(tokenPath, []byte(ch.KeyAuthorization), 0600)
|
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
|
// CleanUp deletes an HTTP-01 Challenge Token
|
||||||
func (s *Solver) CleanUp(ctx context.Context, ch acme.Challenge) error {
|
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(s.Path) {
|
||||||
if 0 == len(tmpBase) {
|
s.Path = tmpBase
|
||||||
myBase = "acme-tmp"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// always try to remove, as there's no harm
|
// 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)
|
_ = os.Remove(tokenPath)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue