diff --git a/cmd/ipfs/init.go b/cmd/ipfs/init.go index fc21f2bc142e44fd7d04bf61d2dfca96872ebe7b..18fbaa134e0e9122e9b93b27c83a90e2985e3f3d 100644 --- a/cmd/ipfs/init.go +++ b/cmd/ipfs/init.go @@ -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 { diff --git a/config/version.go b/config/version.go index bbdcece3af437dceb1d12e01aef53e0029375086..feb354b189e2937de332b905585f5c52311655e3 100644 --- a/config/version.go +++ b/config/version.go @@ -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, + } +}