Documentation
¶
Index ¶
Constants ¶
const EnvProfile = "DASH0_PROFILE"
EnvProfile is the environment variable that selects a named profile for the current invocation, overriding the active profile recorded on disk.
Variables ¶
This section is empty.
Functions ¶
func ResolveConfigurationForProfile ¶ added in v1.11.0
func ResolveConfigurationForProfile(profileName string) (*profiles.Configuration, error)
ResolveConfigurationForProfile loads the named profile from the store and applies environment variable overrides on top. It returns a "profile not found" error that lists the available profiles when no profile with the given name exists. When profileName is empty, callers should use the normal active-profile resolution chain; this function only handles explicit selections.
func WithProfileSelector ¶ added in v1.11.0
func WithProfileSelector(ctx context.Context, sel ProfileSelector) context.Context
WithProfileSelector returns a new context carrying the given selector.
Types ¶
type ProfileSelector ¶ added in v1.11.0
type ProfileSelector struct {
// Name is the explicit profile name. An empty string means the selector
// is absent and callers should use the active profile.
Name string
// Source identifies where the Name came from.
Source ProfileSource
}
ProfileSelector records an explicit profile selection and its source.
func ProfileSelectorFromContext ¶ added in v1.11.0
func ProfileSelectorFromContext(ctx context.Context) ProfileSelector
ProfileSelectorFromContext returns the selector stored in ctx, or an empty selector if none is present.
func ResolveProfileSelector ¶ added in v1.11.0
func ResolveProfileSelector(flagValue string) ProfileSelector
ResolveProfileSelector returns the explicit profile selector derived from the --profile flag value and the DASH0_PROFILE environment variable. Empty strings are treated as "not set" and fall through to the next precedence step, which means the caller should use the active profile.
func (ProfileSelector) IsSet ¶ added in v1.11.0
func (s ProfileSelector) IsSet() bool
IsSet reports whether the selector has a non-empty explicit name.
type ProfileSource ¶ added in v1.11.0
type ProfileSource int
ProfileSource identifies where an explicit profile selection came from.
const ( // ProfileSourceNone indicates no explicit selection (the active profile is used). ProfileSourceNone ProfileSource = iota // ProfileSourceFlag indicates the selection came from the --profile flag. ProfileSourceFlag // ProfileSourceEnv indicates the selection came from the DASH0_PROFILE env var. ProfileSourceEnv )
func (ProfileSource) Description ¶ added in v1.11.0
func (s ProfileSource) Description() string
Description returns a human-readable source description suitable for displaying in `config show` alongside a profile name.