diff --git a/cmd/flags.go b/cmd/flags.go index 46df12ce..93425335 100644 --- a/cmd/flags.go +++ b/cmd/flags.go @@ -50,9 +50,10 @@ func CreateFlags(defaultPath string) []cli.Flag { Usage: "(deprecated) Filename of the generated certificate.", }, cli.StringFlag{ - Name: "path", - Usage: "Directory to use for storing the data.", - Value: defaultPath, + Name: "path", + EnvVar: "LEGO_PATH", + Usage: "Directory to use for storing the data.", + Value: defaultPath, }, cli.BoolFlag{ Name: "http", diff --git a/cmd/lego/main.go b/cmd/lego/main.go index 30ac9149..098d15b9 100644 --- a/cmd/lego/main.go +++ b/cmd/lego/main.go @@ -29,11 +29,12 @@ func main() { fmt.Printf("lego version %s %s/%s\n", c.App.Version, runtime.GOOS, runtime.GOARCH) } - defaultPath := "" + var defaultPath string cwd, err := os.Getwd() if err == nil { defaultPath = filepath.Join(cwd, ".lego") } + app.Flags = cmd.CreateFlags(defaultPath) app.Before = cmd.Before