Documentation
¶
Overview ¶
Package config manages the CLI's user-level configuration file.
Config file location follows XDG Base Directory Specification:
- $XDG_CONFIG_HOME/circleci/config.yml (when XDG_CONFIG_HOME is set)
- ~/.config/circleci/config.yml (default)
Index ¶
- Constants
- func ActiveTelemetryOverrides() []string
- func DeleteToken(ctx context.Context, secureStorage bool) error
- func Path() (string, error)
- func SetHost(ctx context.Context, host string) error
- func SetLogin(ctx context.Context, host, token string, userID uuid.UUID, secureStorage bool) error
- func SetLogout(ctx context.Context, secureStorage bool) error
- func SetTelemetry(ctx context.Context, enabled bool, path string) error
- func SetTheme(ctx context.Context, theme string) error
- func SetToken(ctx context.Context, token string, secureStorage bool) error
- type Config
Constants ¶
const DefaultHost = "https://circleci.com"
DefaultHost is the CircleCI API host used when none is configured.
const DefaultTheme = "auto"
DefaultTheme is the color theme used when none is configured. It matches the default of the --theme flag and detects the terminal background.
Variables ¶
This section is empty.
Functions ¶
func ActiveTelemetryOverrides ¶
func ActiveTelemetryOverrides() []string
ActiveTelemetryOverrides returns the names of environment variables that are currently set and override the stored telemetry preference.
func DeleteToken ¶
DeleteToken removes the stored API token from both the config file and the system keyring (when secure storage is in use).
func SetHost ¶
SetHost persists the CircleCI server host. The host is not a secret, so it is always written to the config file and never touches secure storage (passing secureStorage here would make saveTo delete the keyring token).
func SetTelemetry ¶
SetTelemetry persists the telemetry opt-in/opt-out preference. path follows the same convention as Load (empty → XDG default).
func SetTheme ¶
SetTheme persists the color theme preference. The theme is not a secret, so it is always written to the config file and never touches secure storage (passing secureStorage here would make saveTo delete the keyring token). Validation of the value is the caller's responsibility (see iostream.IsValidTheme).
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config holds all persisted CLI settings.
func Load ¶
Load reads the config file from the given path. If path is empty the default XDG path is used. Returns an empty Config if the file does not exist.
func (*Config) EffectiveHost ¶
EffectiveHost returns the host, checked in priority order: CIRCLE_HOST env var → config file value → DefaultHost.
func (*Config) EffectiveTheme ¶
EffectiveTheme returns the configured color theme, or DefaultTheme when none has been set.
func (*Config) EffectiveToken ¶
EffectiveToken returns the token from the config, falling back to the CIRCLE_TOKEN environment variable (with CIRCLE_CLI_TOKEN as a legacy alias).
func (*Config) IsTelemetry ¶
IsTelemetry returns true when telemetry should be collected. Environment variables always take precedence over the stored config value. When no preference has been set, telemetry is enabled by default.