Documentation
¶
Overview ¶
Package launchcfg owns the provider-facing part of launch configuration that every Golder front-end shares. It deliberately stops before run assembly: the CLI, TUI and GUI may build different views, but they must agree on flag/file precedence and on where a credential came from.
Index ¶
- func CanonicalProviderName(name string) string
- func LegacyProviderName(cfg config.FileConfig) string
- func ProviderConnection(cfg config.FileConfig, name string) (config.ProviderProfile, string, bool)
- func SavedProviderProfile(cfg config.FileConfig, name string) (config.ProviderProfile, bool)
- type Changed
- type CredentialResult
- type CredentialSource
- type CredentialStatus
- type Values
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalProviderName ¶ added in v1.5.79
CanonicalProviderName resolves aliases before looking up saved settings.
func LegacyProviderName ¶ added in v1.5.79
func LegacyProviderName(cfg config.FileConfig) string
LegacyProviderName identifies the owner of pre-profile connection settings.
func ProviderConnection ¶ added in v1.5.79
func ProviderConnection(cfg config.FileConfig, name string) (config.ProviderProfile, string, bool)
ProviderConnection returns the settings owned by name. The legacy literal key is returned separately and must not be displayed or copied to a profile.
func SavedProviderProfile ¶ added in v1.5.79
func SavedProviderProfile(cfg config.FileConfig, name string) (config.ProviderProfile, bool)
SavedProviderProfile looks up a provider's saved settings. A protocol previously pinned to a different default no longer applies.
Types ¶
type Changed ¶
Changed reports whether a command-line flag was explicitly supplied. A nil function means no flag was supplied, which is what a settings-only GUI uses.
type CredentialResult ¶
type CredentialResult struct {
Status CredentialStatus
Warnings []string
// contains filtered or unexported fields
}
CredentialResult is the launch-time credential resolution. A value is returned only for an explicit value or a successfully loaded named reference; ambient environment credentials stay ambient and are read by CredentialStore.
func ResolveCredential ¶
func ResolveCredential(providerName, apiKey, credentialRef string) CredentialResult
ResolveCredential applies the shared static credential precedence: explicit/config api_key > named credential > inherited provider environment. A broken named reference warns and falls through to the environment, matching the CLI's historical behavior.
func (CredentialResult) ResolvedValue ¶
func (r CredentialResult) ResolvedValue() string
ResolvedValue returns the launch-only secret for passing into the provider store. Callers must not display or persist it.
type CredentialSource ¶
type CredentialSource string
CredentialSource is safe display metadata. It never contains the credential.
const ( CredentialMissing CredentialSource = "missing" CredentialExplicit CredentialSource = "explicit" CredentialNamed CredentialSource = "named" CredentialEnvironment CredentialSource = "environment" )
type CredentialStatus ¶
type CredentialStatus struct {
Available bool
Source CredentialSource
// Name is the named-credential reference when Source is named.
Name string
// EnvVar is the inherited environment variable when Source is environment.
EnvVar string
}
CredentialStatus tells a UI whether authentication is available and where it came from, without revealing a value.
type Values ¶
type Values struct {
Model string
Provider string
BaseURL string
Protocol string
APIKey string
CredentialRef string
ThinkingLevel string
}
Values is the provider-facing launch state after defaults but before the config file is overlaid. APIKey is secret and must never be formatted or logged; the other fields are ordinary settings.
func Overlay ¶
func Overlay(v Values, cfg config.FileConfig, changed Changed) Values
Overlay applies the shared CLI > config.toml > built-in precedence for the provider-facing fields. A literal api_key wins over a named reference for backward compatibility, but new writers should save only CredentialRef.