File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed
Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ func Run() {
2121
2222 config , err := config .Load (* configPath )
2323 if err != nil {
24- panic (err )
24+ log . Fatal (err . Error () )
2525 }
2626
2727 pendingUpdateCount := prometheus .NewGauge (prometheus.GaugeOpts {
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package config
33import (
44 "errors"
55 "io/ioutil"
6+ "log"
67 "os"
78 "path/filepath"
89
@@ -36,19 +37,18 @@ func Load(configPath string) (*Config, error) {
3637 filename , _ := filepath .Abs (configPath )
3738 yamlFile , err := ioutil .ReadFile (filename )
3839 if err != nil {
39- return nil , err
40- }
41-
42- // var config model.Config
43- err = yaml .Unmarshal (yamlFile , & config )
44- if err != nil {
45- return nil , err
40+ log .Print (err .Error (), ", try to start with default configs" )
41+ } else {
42+ err = yaml .Unmarshal (yamlFile , & config )
43+ if err != nil {
44+ return nil , err
45+ }
4646 }
4747
4848 if envBotToken := os .Getenv ("BOT_TOKEN" ); envBotToken != "" {
4949 config .Telegram .Token = envBotToken
5050 } else if config .Telegram .Token == "" {
51- return nil , errors .New ("Telegram Token is missing in " + configPath )
51+ return nil , errors .New ("Telegram Token is missing" )
5252 }
5353
5454 return & config , nil
You can’t perform that action at this time.
0 commit comments