cueconfig

package
v0.12.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package cueconfig holds internal API relating to CUE configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheDir

func CacheDir(getenv func(string) string) (string, error)

func ConfigDir

func ConfigDir(getenv func(string) string) (string, error)

func LoginConfigPath

func LoginConfigPath(getenv func(string) string) (string, error)

func RegistryOAuthConfig

func RegistryOAuthConfig(host modresolve.Host) oauth2.Config

RegistryOAuthConfig returns the oauth2 configuration suitable for talking to the central registry.

func TokenFromLogin

func TokenFromLogin(login RegistryLogin) *oauth2.Token

func WriteLogins

func WriteLogins(path string, logins *Logins) error

Types

type Logins

type Logins struct {
	Registries map[string]RegistryLogin `json:"registries"`
}

Logins holds the login information as stored in $CUE_CONFIG_DIR/logins.cue.

func ReadLogins

func ReadLogins(path string) (*Logins, error)

func UpdateRegistryLogin added in v0.9.0

func UpdateRegistryLogin(path string, key string, new *oauth2.Token) (*Logins, error)

UpdateRegistryLogin atomically updates a single registry token in the logins.json file.

type RegistryLogin

type RegistryLogin struct {
	AccessToken string `json:"access_token"`

	TokenType string `json:"token_type,omitempty"`

	RefreshToken string `json:"refresh_token,omitempty"`

	Expiry *time.Time `json:"expiry,omitempty"`
}

RegistryLogin holds the login information for one registry.

func LoginFromToken

func LoginFromToken(tok *oauth2.Token) RegistryLogin

Jump to

Keyboard shortcuts

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