config

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package config resolves runtime configuration and zero-secret saved profiles.

Index

Constants

View Source
const (
	EnvBaseURL       = "CLIPROXYAPI_CLI_BASE_URL"
	EnvManagementKey = "CLIPROXYAPI_CLI_MANAGEMENT_KEY"
	EnvStateDir      = "CLIPROXYAPI_CLI_STATE_DIR"
	EnvTimeout       = "CLIPROXYAPI_CLI_TIMEOUT_SECONDS"

	DefaultBaseURL = "http://127.0.0.1:8317/v0/management"
	DefaultTimeout = 20 * time.Second
)
View Source
const (
	ProfileVersion           = 1
	CredentialBackendKeyring = "keyring"
)

Variables

This section is empty.

Functions

func DeleteProfile

func DeleteProfile(dir string) (bool, error)

func ProfilePath

func ProfilePath(dir string) string

func ResolveStateDir

func ResolveStateDir(options LoadOptions) (string, error)

ResolveStateDir resolves the local profile, guard, and confirmation directory.

func SaveProfile

func SaveProfile(dir string, profile Profile) error

Types

type Config

type Config struct {
	BaseURL          string
	ManagementKey    string
	CredentialSource string
	StateDir         string
	Timeout          time.Duration
}

func Load

func Load(options LoadOptions) (Config, error)

func (Config) CredentialFingerprint

func (c Config) CredentialFingerprint() string

type LoadOptions

type LoadOptions struct {
	BaseURL          string
	StateDir         string
	Timeout          time.Duration
	ReadKeyFromStdin bool
	Stdin            io.Reader
	Getenv           func(string) string
	CredentialStore  credential.Store
}

type Profile

type Profile struct {
	Version           int    `json:"version"`
	BaseURL           string `json:"base_url"`
	CredentialBackend string `json:"credential_backend"`
}

Profile contains only non-sensitive metadata. Management credentials are stored separately in the operating-system keyring.

func LoadProfile

func LoadProfile(dir string) (Profile, bool, error)

Jump to

Keyboard shortcuts

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