config

package
v0.10.26 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDir         string      = "~/.omnistrate"
	DefaultFile        string      = "config.yml"
	DefaultPermissions os.FileMode = 0700
)

Variables

View Source
var (
	ErrConfigFileNotFound = errors.New("auth failure: config file not found, please login first")
	ErrAuthConfigNotFound = errors.New("auth failure: auth credentials not found, please login first")
	ErrGitHubPATNotFound  = errors.New("no github personal access token found")
)

Functions

func CleanupArgsAndFlags

func CleanupArgsAndFlags(cmd *cobra.Command, args *[]string)

func ConfigDir

func ConfigDir() string

ConfigDir returns the path to the omnistrate-ctl config directory.

func CreateOrUpdateAuthConfig

func CreateOrUpdateAuthConfig(authConfig AuthConfig) error

CreateOrUpdateAuthConfig creates or updates the authentication configuration.

func CreateOrUpdateGitHubPersonalAccessToken

func CreateOrUpdateGitHubPersonalAccessToken(gitHubPersonalAccessToken string) error

CreateOrUpdateGitHubPersonalAccessToken creates or updates the authentication configuration.

func EnsureFile

func EnsureFile() (string, error)

EnsureFile creates the root directory and config file.

func GetClientTimeout

func GetClientTimeout() time.Duration

func GetDefaultServiceAuthPublicKey

func GetDefaultServiceAuthPublicKey() string

GetDefaultServiceAuthPublicKey returns the default public key for environment creation

func GetEnv added in v0.10.2

func GetEnv(env, defaultValue string) string

func GetEnvAsBoolean added in v0.10.2

func GetEnvAsBoolean(envName, defaultValue string) bool

func GetEnvAsFloat64 added in v0.10.2

func GetEnvAsFloat64(envName, defaultValue string) float64

func GetEnvAsInt64 added in v0.10.2

func GetEnvAsInt64(envName, defaultValue string) int64

func GetEnvAsInteger added in v0.10.2

func GetEnvAsInteger(envName, defaultValue string) int

func GetHost

func GetHost() string

GetHost returns the host of the Omnistrate server

func GetHostScheme

func GetHostScheme() string

GetHostScheme returns the scheme of the Omnistrate server

func GetLogFormat added in v0.10.2

func GetLogFormat() string

func GetLogLevel added in v0.10.2

func GetLogLevel() string

func GetRootDomain

func GetRootDomain() string

GetRootDomain returns the root domain of the Omnistrate server

func GetToken

func GetToken() (string, error)

GetToken returns the authentication token for current user

func IsDebugLogLevel added in v0.10.2

func IsDebugLogLevel() bool

func IsDryRun

func IsDryRun() bool

func IsProd

func IsProd() bool

func LookupGitHubPersonalAccessToken

func LookupGitHubPersonalAccessToken() (string, error)

LookupGitHubPersonalAccessToken returns the authentication configuration.

func RemoveAuthConfig

func RemoveAuthConfig() error

RemoveAuthConfig deletes the authentication configuration.

func RemoveGitHubPersonalAccessToken

func RemoveGitHubPersonalAccessToken() error

RemoveGitHubPersonalAccessToken deletes the authentication configuration.

Types

type AuthConfig

type AuthConfig struct {
	Token string `yaml:"token,omitempty"`
}

AuthConfig represents the authentication configuration.

func LookupAuthConfig

func LookupAuthConfig() (AuthConfig, error)

LookupAuthConfig returns the authentication configuration.

type ConfigFile

type ConfigFile struct {
	AuthConfigs               []AuthConfig `yaml:"auths"`
	GitHubPersonalAccessToken string       `yaml:"github_personal_access_token,omitempty"`
	FilePath                  string       `yaml:"-"`
}

ConfigFile represents the Omnistrate CTL config file.

func New

func New(filePath string) (*ConfigFile, error)

New initializes a config file for the given file path.

Jump to

Keyboard shortcuts

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