diff --git a/cli_handlers.go b/cli_handlers.go index 0ef89441..4faa1a62 100644 --- a/cli_handlers.go +++ b/cli_handlers.go @@ -55,7 +55,7 @@ func setup(c *cli.Context) (*Configuration, *Account, *acme.Client) { } if c.GlobalIsSet("webroot") { - provider, err := webroot.NewHTTPProviderWebroot(c.GlobalString("webroot")) + provider, err := webroot.NewHTTPProvider(c.GlobalString("webroot")) if err != nil { logger().Fatal(err) } diff --git a/providers/http/webroot/webroot.go b/providers/http/webroot/webroot.go index 823f1260..d331c991 100644 --- a/providers/http/webroot/webroot.go +++ b/providers/http/webroot/webroot.go @@ -10,18 +10,18 @@ import ( "github.com/xenolf/lego/acme" ) -// HTTPProviderWebroot implements ChallengeProvider for `http-01` challenge -type HTTPProviderWebroot struct { +// HTTPProvider implements ChallengeProvider for `http-01` challenge +type HTTPProvider struct { path string } -// NewHTTPProviderWebroot returns a HTTPProviderWebroot instance with a configured webroot path -func NewHTTPProviderWebroot(path string) (*HTTPProviderWebroot, error) { +// NewHTTPProvider returns a HTTPProvider instance with a configured webroot path +func NewHTTPProvider(path string) (*HTTPProvider, error) { if _, err := os.Stat(path); os.IsNotExist(err) { return nil, fmt.Errorf("Webroot path does not exist") } - c := &HTTPProviderWebroot{ + c := &HTTPProvider{ path: path, } @@ -29,7 +29,7 @@ func NewHTTPProviderWebroot(path string) (*HTTPProviderWebroot, error) { } // Present makes the token available at `HTTP01ChallengePath(token)` by creating a file in the given webroot path -func (w *HTTPProviderWebroot) Present(domain, token, keyAuth string) error { +func (w *HTTPProvider) Present(domain, token, keyAuth string) error { var err error challengeFilePath := path.Join(w.path, acme.HTTP01ChallengePath(token)) @@ -47,7 +47,7 @@ func (w *HTTPProviderWebroot) Present(domain, token, keyAuth string) error { } // CleanUp removes the file created for the challenge -func (w *HTTPProviderWebroot) CleanUp(domain, token, keyAuth string) error { +func (w *HTTPProvider) CleanUp(domain, token, keyAuth string) error { var err error err = os.Remove(path.Join(w.path, acme.HTTP01ChallengePath(token))) if err != nil { diff --git a/providers/http/webroot/webroot_test.go b/providers/http/webroot/webroot_test.go index 755d947b..99c930ed 100644 --- a/providers/http/webroot/webroot_test.go +++ b/providers/http/webroot/webroot_test.go @@ -6,7 +6,7 @@ import ( "testing" ) -func TestHTTPProviderWebRoot(t *testing.T) { +func TestHTTPProvider(t *testing.T) { webroot := "webroot" domain := "domain" token := "token" @@ -16,7 +16,7 @@ func TestHTTPProviderWebRoot(t *testing.T) { os.MkdirAll(webroot+"/.well-known/acme-challenge", 0777) defer os.RemoveAll(webroot) - provider, err := NewHTTPProviderWebroot(webroot) + provider, err := NewHTTPProvider(webroot) if err != nil { t.Errorf("Webroot provider error: got %v, want nil", err) }