configuration

package
v0.0.0-...-a44c915 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const NeedUpdateAPIConfig = "updateAPIConfig"
View Source
const SkipAuthCheck = "skipAuthCheck"

Variables

View Source
var ErrNoAddr = errors.New("No valid address set, run 'sdpctl configure' or set SDPCTL_URL")

Functions

func CertificateDetails

func CertificateDetails(cert *x509.Certificate) string

func CheckMinAPIVersionRestriction

func CheckMinAPIVersionRestriction(cmd *cobra.Command, currentVersion int) error

func DefaultDeviceID

func DefaultDeviceID() string

DefaultDeviceID return a unique ID in UUID format. machine.ID() tries to read /etc/machine-id on Linux /etc/hostid on BSD ioreg -rd1 -c IOPlatformExpertDevice | grep IOPlatformUUID on OSX reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography /v MachineGuid on Windows and tries to parse the value as a UUID https://github.com/denisbrodbeck/machineid if we can't get a valid UUID based on the machine ID, we will fallback to a random UUID value.

func IsAuthCheckEnabled

func IsAuthCheckEnabled(cmd *cobra.Command) bool

func NeedUpdatedAPIVersionConfig

func NeedUpdatedAPIVersionConfig(cmd *cobra.Command) bool

func NormalizeConfigurationURL

func NormalizeConfigurationURL(u string) (string, error)

func ReadPemFile

func ReadPemFile(path string) (*x509.Certificate, error)

Types

type Config

type Config struct {
	URL                 string  `mapstructure:"url"`
	Provider            *string `mapstructure:"provider"`
	Insecure            bool    `mapstructure:"insecure"`
	Debug               bool    `mapstructure:"debug"`         // http debug flag
	Version             int     `mapstructure:"api_version"`   // api peer interface version
	BearerToken         *string `mapstructure:"bearer:squash"` // current logged in user token
	ExpiresAt           *string `mapstructure:"expires_at"`
	DeviceID            string  `mapstructure:"device_id"`
	PemFilePath         string  `mapstructure:"pem_filepath"` // deprecated in favor of pem_base64, kept for backwards compatibility
	PemBase64           *string `mapstructure:"pem_base64"`
	DisableVersionCheck bool    `mapstructure:"disable_version_check"`
	LastVersionCheck    string  `mapstructure:"last_version_check"`
	NoInteractive       bool    `mapstructure:"-"`
	CiMode              bool    `mapstructure:"-"`
	EventsPath          string  `mapstructure:"-"`
}

func NewConfiguration

func NewConfiguration(profile *string) (*Config, error)

func (*Config) CheckForUpdate

func (c *Config) CheckForUpdate(out io.Writer, client *http.Client, current string) (*Config, error)

func (*Config) ClearBearer

func (c *Config) ClearBearer() error

func (*Config) ClearCredentials

func (c *Config) ClearCredentials() error

func (*Config) ExpiredAtValid

func (c *Config) ExpiredAtValid() bool

func (*Config) GetBearTokenHeaderValue

func (c *Config) GetBearTokenHeaderValue() (string, error)

func (*Config) GetHost

func (c *Config) GetHost() (string, error)

func (*Config) IsRequireAuthentication

func (c *Config) IsRequireAuthentication() bool

func (*Config) KeyringPrefix

func (c *Config) KeyringPrefix() (string, error)

KeyringPrefix is the raw string values that will be used in the keyring package it needs to be a unique, reproducible value for the selected Collective + profile. Downstream, this string value will be converted to a integer value (pkg/hashcode) and used as a prefix when storing values in the keyring/keychain.

func (*Config) LoadCredentials

func (c *Config) LoadCredentials() (*Credentials, error)

func (*Config) StoreCredentials

func (c *Config) StoreCredentials(username, password string) error

type Credentials

type Credentials struct {
	Username string
	Password string
}

Jump to

Keyboard shortcuts

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