forked from TrueCloudLab/lego
cli: Add "LEGO_PATH" environment variable (#1045)
Co-authored-by: Ludovic Fernandez <ldez@users.noreply.github.com>
This commit is contained in:
parent
f5180ad521
commit
59ea57daf6
2 changed files with 6 additions and 4 deletions
|
@ -51,6 +51,7 @@ func CreateFlags(defaultPath string) []cli.Flag {
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "path",
|
Name: "path",
|
||||||
|
EnvVar: "LEGO_PATH",
|
||||||
Usage: "Directory to use for storing the data.",
|
Usage: "Directory to use for storing the data.",
|
||||||
Value: defaultPath,
|
Value: defaultPath,
|
||||||
},
|
},
|
||||||
|
|
|
@ -29,11 +29,12 @@ func main() {
|
||||||
fmt.Printf("lego version %s %s/%s\n", c.App.Version, runtime.GOOS, runtime.GOARCH)
|
fmt.Printf("lego version %s %s/%s\n", c.App.Version, runtime.GOOS, runtime.GOARCH)
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultPath := ""
|
var defaultPath string
|
||||||
cwd, err := os.Getwd()
|
cwd, err := os.Getwd()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
defaultPath = filepath.Join(cwd, ".lego")
|
defaultPath = filepath.Join(cwd, ".lego")
|
||||||
}
|
}
|
||||||
|
|
||||||
app.Flags = cmd.CreateFlags(defaultPath)
|
app.Flags = cmd.CreateFlags(defaultPath)
|
||||||
|
|
||||||
app.Before = cmd.Before
|
app.Before = cmd.Before
|
||||||
|
|
Loading…
Reference in a new issue