2019-03-11 18:56:48 +02:00
|
|
|
package cmd
|
2018-12-06 23:50:17 +02:00
|
|
|
|
|
|
|
import (
|
2020-09-02 03:20:01 +02:00
|
|
|
"github.com/go-acme/lego/v4/log"
|
2022-02-13 13:28:51 +02:00
|
|
|
"github.com/urfave/cli/v2"
|
2018-12-06 23:50:17 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func Before(ctx *cli.Context) error {
|
2022-02-13 13:28:51 +02:00
|
|
|
if ctx.String("path") == "" {
|
2018-12-06 23:50:17 +02:00
|
|
|
log.Fatal("Could not determine current working directory. Please pass --path.")
|
|
|
|
}
|
|
|
|
|
2022-02-13 13:28:51 +02:00
|
|
|
err := createNonExistingFolder(ctx.String("path"))
|
2018-12-06 23:50:17 +02:00
|
|
|
if err != nil {
|
|
|
|
log.Fatalf("Could not check/create path: %v", err)
|
|
|
|
}
|
|
|
|
|
2022-02-13 13:28:51 +02:00
|
|
|
if ctx.String("server") == "" {
|
2018-12-06 23:50:17 +02:00
|
|
|
log.Fatal("Could not determine current working server. Please pass --server.")
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|