token

package
v0.3.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package token resolves a Personal Access Token from multiple sources.

Priority order:

  1. Explicit flag value (--token)
  2. .devlake.env file (plugin-specific key, e.g. GITLAB_TOKEN=...)
  3. Plugin-specific environment variable (e.g. $GITLAB_TOKEN)
  4. 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL