Explorar o código

case if porter.yaml does not exist (#2997)

Feroze Mohideen %!s(int64=3) %!d(string=hai) anos
pai
achega
d973ebff78
Modificáronse 1 ficheiros con 2 adicións e 8 borrados
  1. 2 8
      cli/cmd/apply.go

+ 2 - 8
cli/cmd/apply.go

@@ -107,18 +107,12 @@ func init() {
 }
 
 func apply(_ *types.GetAuthenticatedUserResponse, client *api.Client, _ []string) error {
-	var fileBytes []byte
-	var err error
-	if porterYAML == "" {
+	fileBytes, err := ioutil.ReadFile(porterYAML)
+	if err != nil {
 		stackName := os.Getenv("PORTER_STACK_NAME")
 		if stackName == "" {
 			return fmt.Errorf("a valid porter.yaml file must be specified. Run porter apply --help for more information")
 		}
-	} else {
-		fileBytes, err = ioutil.ReadFile(porterYAML)
-		if err != nil {
-			return fmt.Errorf("error reading porter.yaml: %w", err)
-		}
 	}
 
 	var previewVersion struct {