token

package
v0.0.0-...-53658a8 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrProfileNotFound is returned when a requested profile file does not exist.
	ErrProfileNotFound = errors.New("profile not found")
	// ErrProfileExists is returned when writing an existing profile without force.
	ErrProfileExists = errors.New("profile already exists")
)

Functions

func Delete

func Delete(name string) error

Delete removes a token profile and ignores missing files.

func Dir

func Dir() (string, error)

Dir returns the directory used for profile token files.

func ProfilePath

func ProfilePath(name string) (string, error)

ProfilePath returns the JSON file path for a validated profile name.

func ValidateProfileName

func ValidateProfileName(name string) error

ValidateProfileName returns an error unless name is a safe profile identifier.

func Write

func Write(name string, token Token, force bool) error

Write persists a token profile, refusing to overwrite unless force is true.

Types

type Token

type Token struct {
	Token          string `json:"token"`
	APIURL         string `json:"api_url"`
	AgentName      string `json:"agent_name"`
	Team           string `json:"team"`
	TeamSlug       string `json:"team_slug"`
	CreatedByEmail string `json:"created_by_email"`
	CreatedAt      string `json:"created_at"`
}

Token stores the persisted credentials and profile metadata.

func Read

func Read(name string) (Token, error)

Read loads a token profile unless DISBUG_TOKEN provides an environment override.

Jump to

Keyboard shortcuts

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