github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/libkb/updater_config.go (about)

     1  package libkb
     2  
     3  type InstallID string
     4  
     5  func (i InstallID) Exists() bool {
     6  	return len(i) > 0
     7  }
     8  
     9  func (i InstallID) String() string {
    10  	return string(i)
    11  }
    12  
    13  type JSONUpdaterConfigFile struct {
    14  	*JSONFile
    15  }
    16  
    17  func (j *JSONUpdaterConfigFile) GetInstallID() (ret InstallID) {
    18  	if !j.Exists() {
    19  		return ret
    20  	}
    21  	tmp, err := j.GetWrapper().AtKey("installId").GetString()
    22  	if err == nil {
    23  		ret = InstallID(tmp)
    24  	}
    25  	return ret
    26  }
    27  
    28  func NewJSONUpdaterConfigFile(g *GlobalContext) *JSONUpdaterConfigFile {
    29  	return &JSONUpdaterConfigFile{NewJSONFile(g, g.Env.GetUpdaterConfigFilename(), "updater config")}
    30  }
    31  
    32  var _ UpdaterConfigReader = &JSONUpdaterConfigFile{}