worker: flip error handling when parsing the config
It's more idiomatic this way. Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
parent
c7716c2072
commit
dc78b05a19
1 changed files with 8 additions and 8 deletions
|
|
@ -215,17 +215,17 @@ func main() {
|
|||
}
|
||||
|
||||
config, err := parseConfig(configFile)
|
||||
if err == nil {
|
||||
logrus.Info("Composer configuration:")
|
||||
encoder := toml.NewEncoder(logrus.StandardLogger().WriterLevel(logrus.InfoLevel))
|
||||
err := encoder.Encode(&config)
|
||||
if err != nil {
|
||||
logrus.Fatalf("Could not print config: %v", err)
|
||||
}
|
||||
} else {
|
||||
if err != nil {
|
||||
logrus.Fatalf("Could not load config file '%s': %v", configFile, err)
|
||||
}
|
||||
|
||||
logrus.Info("Composer configuration:")
|
||||
encoder := toml.NewEncoder(logrus.StandardLogger().WriterLevel(logrus.InfoLevel))
|
||||
err = encoder.Encode(&config)
|
||||
if err != nil {
|
||||
logrus.Fatalf("Could not print config: %v", err)
|
||||
}
|
||||
|
||||
cacheDirectory, ok := os.LookupEnv("CACHE_DIRECTORY")
|
||||
if !ok {
|
||||
logrus.Fatal("CACHE_DIRECTORY is not set. Is the service file missing CacheDirectory=?")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue