Commit c6b74207 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

config/init: init Version with CheckPeriod #265

parent 866c2c89
......@@ -136,10 +136,7 @@ func initCmd(c *commander.Command, inp []string) error {
}
// tracking ipfs version used to generate the init folder and adding update checker default setting.
cfg.Version = config.Version{
Check: "error",
Current: updates.Version,
}
cfg.Version = config.VersionDefaultValue()
err = config.WriteConfigFile(filename, cfg)
if err != nil {
......
......@@ -127,8 +127,18 @@ func RecordUpdateCheck(cfg *Config, filename string) {
if cfg.Version.CheckPeriod == "" {
// CheckPeriod was not initialized for some reason (e.g. config file broken)
cfg.Version.CheckPeriod = strconv.Itoa(int(defaultCheckPeriod))
log.Error("config.Version.CheckPeriod not set. config broken?")
}
WriteConfigFile(filename, cfg)
}
// VersionDefaultValue returns the default version config value (for init).
func VersionDefaultValue() Version {
return Version{
Current: CurrentVersionNumber,
Check: "error",
CheckPeriod: strconv.Itoa(int(defaultCheckPeriod)),
AutoUpdate: AutoUpdateMinor,
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment