mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-26 23:53:19 +08:00
config/init: init Version with CheckPeriod #265
This commit is contained in:
@ -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.
|
// tracking ipfs version used to generate the init folder and adding update checker default setting.
|
||||||
cfg.Version = config.Version{
|
cfg.Version = config.VersionDefaultValue()
|
||||||
Check: "error",
|
|
||||||
Current: updates.Version,
|
|
||||||
}
|
|
||||||
|
|
||||||
err = config.WriteConfigFile(filename, cfg)
|
err = config.WriteConfigFile(filename, cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -127,8 +127,18 @@ func RecordUpdateCheck(cfg *Config, filename string) {
|
|||||||
|
|
||||||
if cfg.Version.CheckPeriod == "" {
|
if cfg.Version.CheckPeriod == "" {
|
||||||
// CheckPeriod was not initialized for some reason (e.g. config file broken)
|
// 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)
|
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,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user