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