fix(config): merge default config
This commit is contained in:
parent
e9ba80b948
commit
3999756947
1 changed files with 3 additions and 2 deletions
|
|
@ -44,8 +44,10 @@ func defaultConfig() *Config {
|
|||
func Load() (*Config, error) {
|
||||
path := filepath.Join(constants.ConfigDirPath, "config.toml")
|
||||
f, err := os.Open(path)
|
||||
|
||||
cfg := defaultConfig()
|
||||
if os.IsNotExist(err) {
|
||||
return defaultConfig(), nil
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
|
@ -53,7 +55,6 @@ func Load() (*Config, error) {
|
|||
}
|
||||
defer f.Close()
|
||||
|
||||
var cfg *Config
|
||||
if _, err := toml.NewDecoder(f).Decode(&cfg); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue