Documentation
¶
Overview ¶
Package token resolves a Personal Access Token from multiple sources.
Priority order:
- Explicit flag value (--token)
- .devlake.env file (plugin-specific key, e.g. GITLAB_TOKEN=...)
- Plugin-specific environment variable (e.g. $GITLAB_TOKEN)
- Interactive masked prompt (terminal)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResolveOpts ¶ added in v0.3.7
type ResolveOpts struct {
FlagValue string // explicit --token value
EnvFilePath string // path to .devlake.env
EnvFileKeys []string // keys to check in .devlake.env (e.g. ["GITHUB_PAT", "GITHUB_TOKEN"])
EnvVarNames []string // environment variable names (e.g. ["GITHUB_TOKEN", "GH_TOKEN"])
DisplayName string // plugin display name for prompts (e.g. "GitHub Copilot")
ScopeHint string // required PAT scopes hint
}
ResolveOpts holds the plugin-specific lookup data for token resolution.
type ResolveResult ¶
type ResolveResult struct {
Token string
Source string // "flag", "envfile", "environment", "prompt"
EnvFilePath string // non-empty if loaded from envfile (for cleanup)
}
ResolveResult contains the resolved token and its source.
func Resolve ¶
func Resolve(opts ResolveOpts) (*ResolveResult, error)
Resolve attempts to find a PAT using the priority chain. All lookup keys and display names come from ResolveOpts, making this fully data-driven with no hardcoded plugin assumptions.