config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrProfileNotFound = errors.New("profile not found in config file")

Functions

func ValidateUrl

func ValidateUrl(apiEndpoint string) (*url.URL, error)

Types

type Credential

type Credential struct {
	Profile            string
	KeyID              string
	APIKey             string
	AccessToken        string
	APIEndpoint        string
	UseShepherd        string
	MinShepherdVersion string
	Bucket             string
	ProjectID          string
}

type CredentialManager

type CredentialManager interface {
	CredentialReader
	Export(ctx context.Context, cred *Credential) error
}

type CredentialReader

type CredentialReader interface {
	Current() *Credential
}

type Manager

type Manager struct {
	Logger *slog.Logger
}

func (*Manager) EnsureExists

func (man *Manager) EnsureExists() error

func (*Manager) Import

func (man *Manager) Import(filePath, fenceToken string) (*Credential, error)

func (*Manager) IsCredentialValid

func (man *Manager) IsCredentialValid(profileConfig *Credential) (bool, error)

func (*Manager) IsTokenValid

func (man *Manager) IsTokenValid(tokenStr string) (bool, error)

func (*Manager) IsValid

func (man *Manager) IsValid(profileConfig *Credential) (bool, error)

func (*Manager) Load

func (man *Manager) Load(profile string) (*Credential, error)

func (*Manager) Save

func (man *Manager) Save(profileConfig *Credential) error

type ManagerInterface

type ManagerInterface interface {
	// Loads credential from ~/.gen3/ credential file
	Import(filePath, fenceToken string) (*Credential, error)

	// Loads credential from ~/.gen3/config.ini
	Load(profile string) (*Credential, error)
	Save(cred *Credential) error

	EnsureExists() error
	IsCredentialValid(*Credential) (bool, error)
	IsTokenValid(string) (bool, error)
}

func NewConfigure

func NewConfigure(logs *slog.Logger) ManagerInterface

Jump to

Keyboard shortcuts

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