config

package
v0.8.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const ColorAuto = "auto"

ColorAuto represents the auto-state for colors

View Source
const ColorOff = "off"

ColorOff represents the off-state for colors

View Source
const ColorOn = "on"

ColorOn represnets the on-state for colors

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Profile    Profile
	Color      string
	LogLevel   string
	DeviceName string

	// Helpers
	APIBaseURL       string
	DashboardBaseURL string
	ConsoleBaseURL   string
	WSBaseURL        string
	Insecure         bool

	// Config
	GlobalConfigFile string
	GlobalConfig     *viper.Viper
	LocalConfigFile  string
	LocalConfig      *viper.Viper
}

Config handles all overall configuration for the CLI

func (*Config) EditConfig

func (c *Config) EditConfig() error

EditConfig opens the configuration file in the default editor.

func (*Config) GetConfigFolder

func (c *Config) GetConfigFolder(xdgPath string) string

GetConfigFolder retrieves the folder where the profiles file is stored It searches for the xdg environment path first and will secondarily place it in the home directory

func (*Config) InitConfig

func (c *Config) InitConfig()

InitConfig reads in profiles file and ENV variables if set.

func (*Config) ListProfiles added in v0.8.0

func (c *Config) ListProfiles() []string

func (*Config) RemoveAllProfiles

func (c *Config) RemoveAllProfiles() error

RemoveAllProfiles removes all the profiles from the config file.

func (*Config) UseWorkspace added in v0.8.0

func (c *Config) UseWorkspace(local bool, teamId string, teamMode string) error

UseWorkspace selects the active workspace to be used

func (*Config) WriteGlobalConfig added in v0.8.1

func (c *Config) WriteGlobalConfig() error

func (*Config) WriteLocalConfig added in v0.8.1

func (c *Config) WriteLocalConfig() error

type Profile

type Profile struct {
	Name     string // profile name
	APIKey   string
	TeamID   string
	TeamMode string

	Config *Config
}

func (*Profile) GetConfigField

func (p *Profile) GetConfigField(field string) string

GetConfigField returns the configuration field for the specific profile

func (*Profile) RemoveProfile added in v0.8.0

func (p *Profile) RemoveProfile() error

func (*Profile) SaveProfile added in v0.8.0

func (p *Profile) SaveProfile(local bool) error

func (*Profile) UseProfile added in v0.8.0

func (p *Profile) UseProfile() error

func (*Profile) ValidateAPIKey added in v0.8.0

func (p *Profile) ValidateAPIKey() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL