refactor: ensure type, drop comment

This commit is contained in:
decentral1se 2021-12-19 22:45:08 +01:00
parent 3d3eefb2fe
commit fa0a63c11d
Signed by untrusted user: decentral1se
GPG Key ID: 03789458B3D0C410
1 changed files with 5 additions and 6 deletions

View File

@ -1,7 +1,6 @@
package config package config
import ( import (
"errors"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os" "os"
@ -112,17 +111,17 @@ func readAppEnvFile(appFile AppFile, name AppName) (App, error) {
// newApp creates new App object // newApp creates new App object
func newApp(env AppEnv, name string, appFile AppFile) (App, error) { 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"] domain := env["DOMAIN"]
apptype, ok := env["TYPE"]
if !ok { appType, exists := env["TYPE"]
return App{}, errors.New("missing TYPE variable") if !exists {
return App{}, fmt.Errorf("%s is missing the TYPE env var", name)
} }
return App{ return App{
Name: name, Name: name,
Domain: domain, Domain: domain,
Type: apptype, Type: appType,
Env: env, Env: env,
Server: appFile.Server, Server: appFile.Server,
Path: appFile.Path, Path: appFile.Path,