mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-28 08:47:42 +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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user