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

Commit 12d3eeb

Browse files
committed
fix: write a default config file if not exists #140
1 parent 015bccf commit 12d3eeb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

engine/config.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,12 @@ func InitConf(specPath *string) (*Config, error) {
9090
// user set a config that is not exists, will write to it later
9191
configExists = false
9292
} else {
93-
return nil, err
93+
// write a default config file if not exists and not provided
94+
c := &Config{}
95+
viper.Unmarshal(c)
96+
c.WriteYaml("cloud-torrent.yaml")
97+
log.Println("saved default config cloud-torrent.yaml")
98+
viper.SetConfigFile("cloud-torrent.yaml")
9499
}
95100
}
96101

0 commit comments

Comments
 (0)