فهرست منبع

Merge pull request #1252 from smallstep/carl/startup-noconfig-msg

Helpful message on CA startup when config can't be opened
Carl Tashian 3 سال پیش
والد
کامیت
067f9c9a5f
1فایلهای تغییر یافته به همراه7 افزوده شده و 0 حذف شده
  1. 7 0
      commands/app.go

+ 7 - 0
commands/app.go

@@ -148,6 +148,13 @@ func appAction(ctx *cli.Context) error {
 
 	cfg, err := config.LoadConfiguration(configFile)
 	if err != nil && token == "" {
+		var pathErr *os.PathError
+		if errors.As(err, &pathErr) {
+			fmt.Println("step-ca can't find or open the configuration file for your CA.")
+			fmt.Println("You may need to create a CA first by running `step ca init`.")
+			fmt.Println("Documentation: https://u.step.sm/docs/ca")
+			os.Exit(1)
+		}
 		fatal(err)
 	}