api: use Errorf instead of Fatalf
This commit is contained in:
parent
432ffeebb3
commit
37e772b595
@ -9,7 +9,7 @@ import (
|
||||
func parseConfig() error {
|
||||
binPath, err := filepath.Abs(filepath.Dir(os.Args[0]))
|
||||
if err != nil {
|
||||
logger.Fatalf("cannot load binary path: %v", err)
|
||||
logger.Errorf("cannot load binary path: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ func parseConfig() error {
|
||||
// Mandatory config parameters
|
||||
for _, env := range []string{"POSTGRES", "PORT", "ORIGIN"} {
|
||||
if os.Getenv(env) == "" {
|
||||
logger.Fatalf("missing %s environment variable", env)
|
||||
logger.Errorf("missing %s environment variable", env)
|
||||
return errorMissingConfig
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ Subject: {{.Subject}}
|
||||
|
||||
`)
|
||||
if err != nil {
|
||||
logger.Fatalf("cannot parse header template: %v", err)
|
||||
logger.Errorf("cannot parse header template: %v", err)
|
||||
return errorMalformedTemplate
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ Subject: {{.Subject}}
|
||||
templates[name] = template.New(name)
|
||||
templates[name], err = template.ParseFiles(fmt.Sprintf("%s/templates/%s.html", os.Getenv("COMMENTO_STATIC"), name))
|
||||
if err != nil {
|
||||
logger.Fatalf("cannot parse %s/templates/%s.html: %v", os.Getenv("STATIC"), name, err)
|
||||
logger.Errorf("cannot parse %s/templates/%s.html: %v", os.Getenv("STATIC"), name, err)
|
||||
return errorMalformedTemplate
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user