config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAPIEndpoint  = "api.scale.sh"
	DefaultAuthEndpoint = "auth.scale.sh"
)

Variables

View Source
var (
	ErrAPIEndpointRequired  = errors.New("api endpoint is required")
	ErrAuthEndpointRequired = errors.New("auth endpoint is required")
	ErrNoSession            = errors.New("no session found")
)
View Source
var (
	DefaultCookieURL = &url.URL{
		Scheme: "https",
		Host:   "scale.sh",
	}
)

Functions

This section is empty.

Types

type Config

type Config struct {
	APIEndpoint    string           `yaml:"api_endpoint"`
	AuthEndpoint   string           `yaml:"auth_endpoint"`
	CacheDirectory string           `yaml:"cache_directory"`
	Session        *session.Session `yaml:"-"`
	// contains filtered or unexported fields
}

Config is dynamically sourced from various files and environment variables.

func New

func New() *Config

func (*Config) APIClient

func (c *Config) APIClient() *apiClient.ScaleAPIV1

func (*Config) AuthClient

func (c *Config) AuthClient() *authClient.AuthAPIV1

func (*Config) DefaultConfigDir

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

func (*Config) DefaultConfigFile

func (c *Config) DefaultConfigFile() string

func (*Config) DefaultConfigPath

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

func (*Config) DefaultLogFile

func (c *Config) DefaultLogFile() string

func (*Config) DefaultLogPath

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

func (*Config) GetConfigFile

func (c *Config) GetConfigFile() string

func (*Config) GetLogFile

func (c *Config) GetLogFile() string

func (*Config) GlobalRequiredFlags

func (c *Config) GlobalRequiredFlags(_ *cobra.Command) error

func (*Config) IsAuthenticated

func (c *Config) IsAuthenticated() bool

func (*Config) NewAuthenticatedAPIClient

func (c *Config) NewAuthenticatedAPIClient() (*apiClient.ScaleAPIV1, error)

NewAuthenticatedAPIClient creates an Authenticated Scale API client from our configuration

func (*Config) NewAuthenticatedAuthClient

func (c *Config) NewAuthenticatedAuthClient() (*authClient.AuthAPIV1, error)

NewAuthenticatedAuthClient creates an Authenticated Scale Auth API client from our configuration

func (*Config) NewUnauthenticatedAPIClient

func (c *Config) NewUnauthenticatedAPIClient() *apiClient.ScaleAPIV1

NewUnauthenticatedAPIClient creates an Unauthenticated Scale API client from our configuration

func (*Config) NewUnauthenticatedAuthClient

func (c *Config) NewUnauthenticatedAuthClient() *authClient.AuthAPIV1

NewUnauthenticatedAuthClient creates an Unauthenticated Scale Auth API client from our configuration

func (*Config) RootPersistentFlags

func (c *Config) RootPersistentFlags(flags *pflag.FlagSet)

func (*Config) SessionPath

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

SessionPath is the path for the session file

func (*Config) SetAPIClient

func (c *Config) SetAPIClient(apiClient *apiClient.ScaleAPIV1)

func (*Config) SetAuthClient

func (c *Config) SetAuthClient(authClient *authClient.AuthAPIV1)

func (*Config) SetConfigFile

func (c *Config) SetConfigFile(file string)

func (*Config) SetLogFile

func (c *Config) SetLogFile(file string)

func (*Config) Validate

func (c *Config) Validate() error

func (*Config) WriteSession

func (c *Config) WriteSession() error

Jump to

Keyboard shortcuts

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