settings

package
v0.1.30549 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 16 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FS afero.Afero = afero.Afero{
		Fs: afero.NewOsFs(),
	}
)

Functions

func ReadFromEnv added in v0.1.3397

func ReadFromEnv(prefix, field string) string

ReadFromEnv takes a prefix and field to search the environment for after capitalizing and joining them with an underscore.

func SettingsPath added in v0.1.6893

func SettingsPath() string

settingsPath returns the path of the CLI settings directory

Types

type Config added in v0.1.3397

type Config struct {
	Host            string        `yaml:"host"`
	DlHost          string        `yaml:"-"`
	Endpoint        string        `yaml:"endpoint"`
	Token           string        `yaml:"token"`
	RestEndpoint    string        `yaml:"rest_endpoint"`
	TLSCert         string        `yaml:"tls_cert"`
	TLSInsecure     bool          `yaml:"tls_insecure"`
	HTTPClient      *http.Client  `yaml:"-"`
	Data            *data.DataBag `yaml:"-"`
	Debug           bool          `yaml:"-"`
	Address         string        `yaml:"-"`
	FileUsed        string        `yaml:"-"`
	GitHubAPI       string        `yaml:"-"`
	SkipUpdateCheck bool          `yaml:"-"`
	// Parameter used to disable telemetry from tests
	IsTelemetryDisabled bool `yaml:"-"`
	// If this value is defined, the telemetry will write all its events a file
	// The value of this field is the path where the telemetry will be written
	MockTelemetry string            `yaml:"-"`
	OrbPublishing OrbPublishingInfo `yaml:"orb_publishing"`
	TempDir       string            `yaml:"temp_dir,omitempty"`
}

Config is used to represent the current state of a CLI instance.

func (*Config) Load added in v0.1.3397

func (cfg *Config) Load() error

Load will read the config from the user's disk and then evaluate possible configuration from the environment.

func (*Config) LoadFromDisk added in v0.1.3397

func (cfg *Config) LoadFromDisk() error

LoadFromDisk is used to read config from the user's disk and deserialize the YAML into our runtime config.

func (*Config) LoadFromEnv added in v0.1.3397

func (cfg *Config) LoadFromEnv(prefix string)

LoadFromEnv will read from environment variables of the given prefix for host, endpoint, and token specifically.

func (*Config) ServerURL added in v0.1.20105

func (cfg *Config) ServerURL() (*url.URL, error)

ServerURL retrieves and formats a ServerURL from our restEndpoint and host.

func (*Config) WithHTTPClient added in v0.1.15338

func (cfg *Config) WithHTTPClient() error

func (*Config) WriteToDisk added in v0.1.3397

func (cfg *Config) WriteToDisk() error

WriteToDisk will write the runtime config instance to disk by serializing the YAML

type OrbPublishingInfo added in v0.1.9988

type OrbPublishingInfo struct {
	DefaultNamespace   string `yaml:"default_namespace"`
	DefaultVcsProvider string `yaml:"default_vcs_provider"`
	DefaultOwner       string `yaml:"default_owner"`
}

type TelemetrySettings added in v0.1.28363

type TelemetrySettings struct {
	IsEnabled         bool   `yaml:"is_enabled"`
	HasAnsweredPrompt bool   `yaml:"has_answered_prompt"`
	UniqueID          string `yaml:"unique_id"`
	UserID            string `yaml:"user_id"`
}

TelemetrySettings is used to represent telemetry related settings

func (*TelemetrySettings) Load added in v0.1.28363

func (tel *TelemetrySettings) Load() error

Load will read the telemetry settings from the user's disk and then deserialize it into the current instance.

func (*TelemetrySettings) Write added in v0.1.28363

func (tel *TelemetrySettings) Write() error

WriteToDisk will write the telemetry settings to disk by serializing the YAML

type UpdateCheck added in v0.1.4005

type UpdateCheck struct {
	LastUpdateCheck time.Time `yaml:"last_update_check"`
	FileUsed        string    `yaml:"-"`
}

UpdateCheck is used to represent settings for checking for updates of the CLI.

func (*UpdateCheck) Load added in v0.1.4005

func (upd *UpdateCheck) Load() error

Load will read the update check settings from the user's disk and then deserialize it into the current instance.

func (*UpdateCheck) WriteToDisk added in v0.1.4005

func (upd *UpdateCheck) WriteToDisk() error

WriteToDisk will write the last update check to disk by serializing the YAML

Jump to

Keyboard shortcuts

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