Documentation
¶
Index ¶
- Constants
- Variables
- func GenMachineID() string
- func GetDefaultConfigFile() string
- func IsTokenValid(token string) bool
- func IsUnlockError(err error) bool
- type Config
- func (config *Config) ClearKeyring(username string) error
- func (config *Config) GetKeyring() string
- func (config *Config) GetMachineID() string
- func (config *Config) GetNamspace(jobType libremotebuild.JobType) string
- func (config *Config) GetToken() (string, error)
- func (config *Config) InsertUser(user, token string)
- func (config Config) IsDefault() bool
- func (config *Config) IsLoggedIn() bool
- func (config Config) MustGetRequestConfig() *libremotebuild.RequestConfig
- func (config *Config) MustSetToken(token string)
- func (config *Config) Save() error
- func (config *Config) SetMachineID()
- func (config *Config) SetToken(token string) error
- func (config Config) ToRequestConfig() (*libremotebuild.RequestConfig, error)
- func (config *Config) Validate() error
- func (config Config) View(redactSecrets bool) string
Constants ¶
const ( // File constants DataDir = ".remotebuild" DefaultConfigFile = "config.yaml" // Keyring constants DefaultKeyring = "login" KeyringServiceName = "RemoteBuild" )
...
Variables ¶
var ( // ErrUnlockingKeyring error if keyring is available but can't be unlocked ErrUnlockingKeyring = errors.New("Error unlocking keyring") )
Functions ¶
func GenMachineID ¶
func GenMachineID() string
GenMachineID detect the machineID. If not detected return random string
func GetDefaultConfigFile ¶
func GetDefaultConfigFile() string
GetDefaultConfigFile return path of default config
func IsTokenValid ¶
IsTokenValid return true if given token is a vaild session token
func IsUnlockError ¶
IsUnlockError return true if err is unlock error
Types ¶
type Config ¶
type Config struct { File string MachineID string User userConfig DefaultUploadTo string Server serverConfig DataManager dataManager }
Config Configuration structure
func InitConfig ¶
InitConfig inits the configfile
func (*Config) ClearKeyring ¶
ClearKeyring removes session from keyring
func (*Config) GetKeyring ¶
GetKeyring returns the keyring to use
func (*Config) GetMachineID ¶
GetMachineID returns the machineID
func (*Config) GetNamspace ¶
func (config *Config) GetNamspace(jobType libremotebuild.JobType) string
GetNamspace return namespace to use for a given job
func (*Config) InsertUser ¶
InsertUser insert a new user
func (*Config) IsLoggedIn ¶
IsLoggedIn return true if sessiondata is available
func (Config) MustGetRequestConfig ¶
func (config Config) MustGetRequestConfig() *libremotebuild.RequestConfig
MustGetRequestConfig create a libdm requestconfig from given cli client config and fatal on error
func (*Config) MustSetToken ¶
MustSetToken fatals on error
func (*Config) SetMachineID ¶
func (config *Config) SetMachineID()
SetMachineID sets machineID if empty
func (*Config) SetToken ¶
SetToken sets token for client Tries to save token in a keyring, if not supported save it unencrypted
func (Config) ToRequestConfig ¶
func (config Config) ToRequestConfig() (*libremotebuild.RequestConfig, error)
ToRequestConfig create a libdm requestconfig from given cli client config If token is not set, error has a value and token is equal to an empty string