From fa0a63c11d97d4b85ec140bdc1c0d81edfe98952 Mon Sep 17 00:00:00 2001 From: cellarspoon Date: Sun, 19 Dec 2021 22:45:08 +0100 Subject: [PATCH] refactor: ensure type, drop comment --- pkg/config/app.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/config/app.go b/pkg/config/app.go index 38fe27594..3fd377498 100644 --- a/pkg/config/app.go +++ b/pkg/config/app.go @@ -1,7 +1,6 @@ package config import ( - "errors" "fmt" "io/ioutil" "os" @@ -112,17 +111,17 @@ func readAppEnvFile(appFile AppFile, name AppName) (App, error) { // newApp creates new App object func newApp(env AppEnv, name string, appFile AppFile) (App, error) { - // Checking for type as it is required - apps wont work without it domain := env["DOMAIN"] - apptype, ok := env["TYPE"] - if !ok { - return App{}, errors.New("missing TYPE variable") + + appType, exists := env["TYPE"] + if !exists { + return App{}, fmt.Errorf("%s is missing the TYPE env var", name) } return App{ Name: name, Domain: domain, - Type: apptype, + Type: appType, Env: env, Server: appFile.Server, Path: appFile.Path,