Commit 9f7dc482 authored by Peter Borzov's avatar Peter Borzov Committed by Juan Batiz-Benet

Add supported Version.Check values as consts

parent 4c167a42
...@@ -119,13 +119,13 @@ func localNode(confdir string, online bool) (*core.IpfsNode, error) { ...@@ -119,13 +119,13 @@ func localNode(confdir string, online bool) (*core.IpfsNode, error) {
return nil, err return nil, err
} }
if cfg.Version.Check != "ignore" { if cfg.Version.Check != config.CheckIgnore {
obsolete := checkForUpdates() obsolete := checkForUpdates()
if obsolete != nil { if obsolete != nil {
fmt.Println(obsolete) if cfg.Version.Check == config.CheckError {
if cfg.Version.Check == "error" {
return nil, obsolete return nil, obsolete
} }
fmt.Println(obsolete) // when "warn" version.check mode we just show warning message
} }
} }
......
...@@ -51,6 +51,12 @@ type Version struct { ...@@ -51,6 +51,12 @@ type Version struct {
Current string `json:"current"` // ipfs version for which config was generated 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. // Config is used to load IPFS config files.
type Config struct { type Config struct {
Identity Identity // local node's peer identity Identity Identity // local node's peer identity
......
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