config

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenStorageInline   = "inline"
	TokenStorageKeychain = "keychain"
)

Variables

This section is empty.

Functions

func DefaultAPIURL

func DefaultAPIURL() string

func DefaultConfigPath

func DefaultConfigPath() (string, error)

func FlattenTransport

func FlattenTransport(cfg *TransportConfig) *rstream.Transport

func NewClientFromEnv

func NewClientFromEnv() (*rstream.Client, error)

func NewClientFromEnvOptions

func NewClientFromEnvOptions(opts ClientEnvOptions) (*rstream.Client, error)

func NewClientFromResolved

func NewClientFromResolved(resolved Resolved) (*rstream.Client, error)

func TokenFromAuth

func TokenFromAuth(auth *Auth) (string, bool, error)

func WriteAtomic

func WriteAtomic(path string, cfg Config) error

Types

type Auth

type Auth struct {
	Token *Token `yaml:"token,omitempty"`
}

type BindConfig

type BindConfig struct {
	Mode      string `yaml:"mode,omitempty"`
	Interface string `yaml:"interface,omitempty"`
	Address   string `yaml:"address,omitempty"`
}

type ClientEnvOptions

type ClientEnvOptions struct {
	ConfigPath    string
	APIURL        string
	Context       string
	Engine        string
	Token         string
	RequireEngine bool
	RequireToken  bool
}

type ClientResolution

type ClientResolution struct {
	ConfigPath string
	Config     Config
	Resolved   Resolved
}

func ResolveFromEnv

func ResolveFromEnv(opts ClientEnvOptions) (ClientResolution, error)

type Config

type Config struct {
	Version      int           `yaml:"version,omitempty"`
	Defaults     Defaults      `yaml:"defaults,omitempty"`
	Environments []Environment `yaml:"environments,omitempty"`
	Contexts     []Context     `yaml:"contexts,omitempty"`
}

func Load

func Load(path string) (Config, error)

func (*Config) EnsureEnvironment

func (c *Config) EnsureEnvironment(apiURL string) *Environment

func (*Config) EnsureVersion

func (c *Config) EnsureVersion()

func (*Config) FindContextByName

func (c *Config) FindContextByName(name string) (*Context, int, error)

func (*Config) FindContextByNameAndAPIURL

func (c *Config) FindContextByNameAndAPIURL(name, apiURL string) (*Context, int, error)

func (*Config) FindContextForAPIURL

func (c *Config) FindContextForAPIURL(name, apiURL string) (*Context, int, error)

func (*Config) FindContextUnlinked

func (c *Config) FindContextUnlinked(name string) (*Context, int, error)

func (*Config) FindEnvironment

func (c *Config) FindEnvironment(apiURL string) (*Environment, int)

func (*Config) Normalize

func (c *Config) Normalize()

type Context

type Context struct {
	Name            string           `yaml:"name"`
	APIURL          string           `yaml:"apiUrl,omitempty"`
	ProjectEndpoint string           `yaml:"projectEndpoint,omitempty"`
	Engine          string           `yaml:"engine,omitempty"`
	Auth            *Auth            `yaml:"auth,omitempty"`
	Transport       *TransportConfig `yaml:"transport,omitempty"`
}

type DNSConfig

type DNSConfig struct {
	Override string `yaml:"override,omitempty"`
}

type DefaultContext

type DefaultContext struct {
	Name string `yaml:"name,omitempty"`
}

type Defaults

type Defaults struct {
	Context *DefaultContext `yaml:"context,omitempty"`
}

type EnvSettings

type EnvSettings struct {
	ConfigPath string
	APIURL     string
	Context    string
	Engine     string
	Token      string
}

func ReadEnv

func ReadEnv() EnvSettings

type Environment

type Environment struct {
	APIURL    string           `yaml:"apiUrl"`
	Auth      *Auth            `yaml:"auth,omitempty"`
	Transport *TransportConfig `yaml:"transport,omitempty"`
}

type FileLock

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

func LockFile

func LockFile(path string) (*FileLock, error)

func (*FileLock) Unlock

func (l *FileLock) Unlock()

type ProxyConfig

type ProxyConfig struct {
	HTTP     string            `yaml:"http,omitempty"`
	Username string            `yaml:"username,omitempty"`
	Password string            `yaml:"password,omitempty"`
	Headers  map[string]string `yaml:"headers,omitempty"`
}

type ResolveInput

type ResolveInput struct {
	Config        Config
	FlagAPIURL    string
	FlagContext   string
	FlagEngine    string
	FlagToken     string
	EnvAPIURL     string
	EnvContext    string
	EnvEngine     string
	EnvToken      string
	RequireToken  bool
	RequireEngine bool
	ResolveToken  bool
}

type Resolved

type Resolved struct {
	APIURL      string
	ContextName string
	Environment *Environment
	Context     *Context
	Engine      string
	Token       string
	Transport   *rstream.Transport
}

func Resolve

func Resolve(input ResolveInput) (Resolved, error)

type Token

type Token struct {
	Storage *TokenStorage `yaml:"storage,omitempty"`
}

type TokenStorage

type TokenStorage struct {
	Kind  string `yaml:"kind,omitempty"`
	Value string `yaml:"value,omitempty"`
}

type TransportConfig

type TransportConfig struct {
	Bind     *BindConfig  `yaml:"bind,omitempty"`
	IPFamily string       `yaml:"ipFamily,omitempty"`
	DNS      *DNSConfig   `yaml:"dns,omitempty"`
	MPTCP    *bool        `yaml:"mptcp,omitempty"`
	Proxy    *ProxyConfig `yaml:"proxy,omitempty"`
}

func MergeTransport

func MergeTransport(base, override *TransportConfig) *TransportConfig

Jump to

Keyboard shortcuts

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