소스 검색

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

Feroze Mohideen 3 년 전
부모
커밋
d973ebff78
1개의 변경된 파일2개의 추가작업 그리고 8개의 파일을 삭제
  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 {