gocuelang.org/go/internal/cueconfig Index | Files

package cueconfig

import "cuelang.org/go/internal/cueconfig"

Package cueconfig holds internal API relating to CUE configuration.

Index

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)

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

Source Files

config.go

Version
v0.9.0-alpha.1
Published
Mar 21, 2024
Platform
js/wasm
Imports
7 packages
Last checked
48 minutes ago

Tools for package owners.