config

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ConfigFile      string
	AlsoLogToStderr bool
	Verbose         bool
	ProjectID       string
	LocalMode       bool
	PprofEnabled    bool

	DefaultConfig = &configv1alpha1.Config{
		DashboardURL: "https://dashboard.apoxy.dev",
		Projects: []configv1alpha1.Project{{
			APIBaseURL: "https://api.apoxy.dev",
		}},
	}
)
View Source
var ErrNoCredentials = errors.New("no API key for the current project; run `apoxy auth login`")

ErrNoCredentials is returned by DefaultAPIClient when the current project exists in the config but carries no API key (the user never logged in, or logged out). Callers with an alternative client path (e.g. kubeconfig discovery) can errors.Is on it to fall back cleanly.

View Source
var ErrUnauthenticated = errors.New("not authenticated")

ErrUnauthenticated is returned by Check when the server explicitly rejects the credentials (HTTP 401/403). Other errors mean the check could not be completed (network, missing config, server error).

Functions

func ApoxyDir

func ApoxyDir() string

ApoxyDir returns the path to the Apoxy configuration directory.

func DefaultAPIClient

func DefaultAPIClient() (*rest.APIClient, error)

DefaultAPIClient returns a new Apoxy API client.

func Load

func Load() (*configv1alpha1.Config, error)

func Store

func Store(cfg *configv1alpha1.Config) error

Types

type Authenticator

type Authenticator struct {
	// contains filtered or unexported fields
}

func NewAuthenticator

func NewAuthenticator(cfg *configv1alpha1.Config, opts ...AuthenticatorOption) *Authenticator

func (*Authenticator) Authenticate

func (a *Authenticator) Authenticate()

func (*Authenticator) Check

func (a *Authenticator) Check() error

type AuthenticatorOption

type AuthenticatorOption func(*Authenticator)

AuthenticatorOption is a functional option for configuring the Authenticator.

func WithAPIBaseURL

func WithAPIBaseURL(url string) AuthenticatorOption

WithAPIBaseURL sets the API base URL for the authenticated project.

type UnversionedConfig

type UnversionedConfig struct {
	// The API key to use for authentication.
	APIKey string `yaml:"api_key,omitempty"`
	// The project ID to use for authentication.
	ProjectID uuid.UUID `yaml:"project_id,omitempty"`
	// Whether to enable verbose logging.
	Verbose bool `yaml:"verbose,omitempty"`
	// The base URL for API requests.
	APIBaseURL string `yaml:"api_base_url,omitempty"`
	// The host header to set for API requests.
	APIBaseHost string `yaml:"api_base_host,omitempty"`
	// The URL for the dashboard UI.
	DashboardURL string `yaml:"dashboard_url,omitempty"`
}

Jump to

Keyboard shortcuts

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