mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-29 17:36:38 +08:00
Add supported Version.Check values as consts
This commit is contained in:

committed by
Juan Batiz-Benet

parent
4c167a42e2
commit
9f7dc48201
@ -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 {
|
|||||||
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
|
||||||
|
Reference in New Issue
Block a user