mirror of
https://github.com/go-acme/lego.git
synced 2025-03-22 14:59:47 +02:00
Allow setting "--path" even if os.Getwd() fails
This commit is contained in:
parent
a62452db95
commit
e7292edf3c
11
cli.go
11
cli.go
@ -41,11 +41,18 @@ func main() {
|
|||||||
|
|
||||||
acme.UserAgent = "lego/" + app.Version
|
acme.UserAgent = "lego/" + app.Version
|
||||||
|
|
||||||
|
defaultPath := ""
|
||||||
cwd, err := os.Getwd()
|
cwd, err := os.Getwd()
|
||||||
if err != nil {
|
if err == nil {
|
||||||
|
defaultPath = path.Join(cwd, ".lego")
|
||||||
|
}
|
||||||
|
|
||||||
|
app.Before = func(c *cli.Context) error {
|
||||||
|
if c.GlobalString("path") == "" {
|
||||||
logger().Fatal("Could not determine current working directory. Please pass --path.")
|
logger().Fatal("Could not determine current working directory. Please pass --path.")
|
||||||
}
|
}
|
||||||
defaultPath := path.Join(cwd, ".lego")
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
app.Commands = []cli.Command{
|
app.Commands = []cli.Command{
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user