diff --git a/cmd/ipfs/ipfs.go b/cmd/ipfs/ipfs.go index ee1ea6c46..7967a9f4a 100644 --- a/cmd/ipfs/ipfs.go +++ b/cmd/ipfs/ipfs.go @@ -119,13 +119,13 @@ func localNode(confdir string, online bool) (*core.IpfsNode, error) { return nil, err } - if cfg.Version.Check != "ignore" { + if cfg.Version.Check != config.CheckIgnore { obsolete := checkForUpdates() if obsolete != nil { - fmt.Println(obsolete) - if cfg.Version.Check == "error" { + if cfg.Version.Check == config.CheckError { return nil, obsolete } + fmt.Println(obsolete) // when "warn" version.check mode we just show warning message } } diff --git a/config/config.go b/config/config.go index 4c47c3227..c836b1d84 100644 --- a/config/config.go +++ b/config/config.go @@ -51,6 +51,12 @@ type Version struct { Current string `json:"current"` // ipfs version for which config was generated } +const ( + CheckError = "error" // value for Version.Check to raise error and exit if version is obsolete + CheckWarn = "warn" // value for Version.Check to show warning message if version is obsolete + CheckIgnore = "ignore" // value for Version.Check to not perform update check +) + // Config is used to load IPFS config files. type Config struct { Identity Identity // local node's peer identity