Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
fix: write a default config file if not exists #140
Browse files Browse the repository at this point in the history
  • Loading branch information
boypt committed Sep 17, 2021
1 parent 015bccf commit 12d3eeb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion engine/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ func InitConf(specPath *string) (*Config, error) {
// user set a config that is not exists, will write to it later
configExists = false
} else {
return nil, err
// write a default config file if not exists and not provided
c := &Config{}
viper.Unmarshal(c)
c.WriteYaml("cloud-torrent.yaml")
log.Println("saved default config cloud-torrent.yaml")
viper.SetConfigFile("cloud-torrent.yaml")
}
}

Expand Down

0 comments on commit 12d3eeb

Please sign in to comment.