Skip to content

Commit

Permalink
Update icq-relayer/pkg/types/config.go
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
joe-bowman and coderabbitai[bot] authored Nov 14, 2024
1 parent d54ea30 commit f36562a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions icq-relayer/pkg/types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,21 @@ func InitializeConfigFromToml(homepath string) Config {
config := Config{}
_, err := toml.DecodeFile(filepath.Join(homepath, "config.toml"), &config)
if err != nil {
//log.Fatal().Msg(fmt.Sprintf("Error Decoding config: %v\n", err.Error()))
fmt.Printf("Error Decoding config: %v\n", err.Error())
log.Printf("Error decoding config: %v\n", err)
}

if config.DefaultChain == nil {
config = NewConfig()
file, err := os.Create(filepath.Join(homepath, "config.toml"))
if err != nil {
log.Fatalf(fmt.Sprintf("Error creating config file: %v\n", err.Error()))
log.Fatalf("Error creating config file: %v", err)
}
if err := toml.NewEncoder(file).Encode(config); err != nil {
file.Close()
log.Fatalf("Error encoding config: %v", err)
}
file.Close()
defer toml.NewEncoder(file).Encode(config)
}
//zerolog.SetGlobalLevel(config.LogLevel)
config.HomePath = homepath
return config
}
Expand Down

0 comments on commit f36562a

Please sign in to comment.