Documentation
¶
Overview ¶
Package config loads reusable Directory client context configuration.
Index ¶
- Constants
- func DefaultPath() (string, error)
- func ResolveDoctor(opts ResolveOptions) (*Doctor, *ResolvedContext, error)
- func SaveFile(path string, file *File) error
- type Context
- type ContextSummary
- type ContextValidation
- type Doctor
- type File
- type LoadOptions
- type ResolveOptions
- type ResolvedContext
Constants ¶
const ( // DefaultEnvPrefix is the default environment variable prefix for client config. DefaultEnvPrefix = dirclient.DefaultEnvPrefix // ClientContextEnv is the DIRECTORY_CLIENT-prefixed context selection environment variable. ClientContextEnv = "DIRECTORY_CLIENT_CONTEXT" )
Variables ¶
This section is empty.
Functions ¶
func DefaultPath ¶
DefaultPath returns the default reusable client config file path.
func ResolveDoctor ¶
func ResolveDoctor(opts ResolveOptions) (*Doctor, *ResolvedContext, error)
ResolveDoctor resolves diagnostic-only settings for the selected context.
Types ¶
type Context ¶
type Context struct {
ServerAddress string `yaml:"server_address"`
TlsSkipVerify bool `yaml:"tls_skip_verify"`
TlsCertFile string `yaml:"tls_cert_file"`
TlsKeyFile string `yaml:"tls_key_file"`
TlsCAFile string `yaml:"tls_ca_file"`
SpiffeSocketPath string `yaml:"spiffe_socket_path"`
SpiffeToken string `yaml:"spiffe_token"`
AuthMode string `yaml:"auth_mode"`
JWTAudience string `yaml:"jwt_audience"`
OIDCIssuer string `yaml:"oidc_issuer"`
OIDCClientID string `yaml:"oidc_client_id"`
AuthToken string `yaml:"auth_token"`
Doctor Doctor `yaml:"doctor"`
}
Context is a named client configuration block.
type ContextSummary ¶
ContextSummary is a list entry for a configured context.
func ListContexts ¶
func ListContexts(path string) ([]ContextSummary, error)
ListContexts lists configured contexts in name order.
type ContextValidation ¶
ContextValidation describes the validation result for a configured context.
func ValidateContexts ¶
func ValidateContexts(path string, name string) ([]ContextValidation, error)
ValidateContexts validates stored context definitions without applying environment overrides.
type Doctor ¶
type Doctor struct {
BootstrapPeers []string `yaml:"bootstrap_peers"`
}
Doctor holds diagnostic-only settings for dirctl doctor.
type File ¶
type File struct {
CurrentContext string `yaml:"current_context"`
Contexts map[string]Context `yaml:"contexts"`
}
File is the top-level reusable client context configuration file.
func LoadFileWithOptions ¶
func LoadFileWithOptions(path string, opts LoadOptions) (*File, error)
LoadFileWithOptions loads a reusable client context config file from path with parsing options.
type LoadOptions ¶
type LoadOptions struct {
// AllowUnknownFields permits forward-compatible parsing for callers that only
// need known client fields from a config that may include command extensions.
AllowUnknownFields bool
}
LoadOptions controls how a reusable client context config file is loaded.
type ResolveOptions ¶
type ResolveOptions struct {
// Path is the config file path. If empty, DefaultPath is used.
Path string
// Context is an explicit context name override.
Context string
// EnvPrefix is the client environment variable prefix. If empty,
// DefaultEnvPrefix is used.
EnvPrefix string
// Overrides contains explicit values, typically from CLI flags.
Overrides *dirclient.Config
// OverrideFields lists schema field names from Overrides that should be
// applied, including zero values. If empty, non-zero override values are
// applied.
OverrideFields []string
// SkipValidation skips required-field validation for callers that only need
// a subset of client config, such as auth token cache commands.
SkipValidation bool
// AllowUnknownFields permits forward-compatible parsing for callers that only
// need known client fields from a config that may include command extensions.
AllowUnknownFields bool
}
ResolveOptions controls context and client configuration resolution.
type ResolvedContext ¶
ResolvedContext describes which context was selected during resolution.
func CurrentContext ¶
func CurrentContext(path string) (*ResolvedContext, error)
CurrentContext returns the persisted current_context without resolving client settings.
func Resolve ¶
func Resolve(opts ResolveOptions) (*dirclient.Config, *ResolvedContext, error)
Resolve resolves the effective Directory client config.
func SetCurrentContext ¶
func SetCurrentContext(path string, name string) (*ResolvedContext, error)
SetCurrentContext persists name as the active context.