config

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config manages CLI configuration and settings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthFilePath

func AuthFilePath() (string, error)

AuthFilePath returns the credential file beside the configuration file.

func Init

func Init(configFile string) error

Init configures Viper defaults and environment bindings and reads the config file. It serializes access to Viper and returns file-reading errors.

Types

type Config

type Config struct {
	Verbose bool `json:"verbose" mapstructure:"verbose"`

	NoInteraction bool `json:"no_interaction" mapstructure:"no_interaction"`

	CachePath string `json:"cache_path" mapstructure:"cache_path"`

	Auth authConfig `json:"auth" mapstructure:"auth"`

	OAuth OAuthConfig `json:"oauth" mapstructure:"oauth"`
}

Config holds CLI settings for output, interaction, cache, credential storage, and OAuth endpoints and credentials.

func Load

func Load() (Config, error)

Load unmarshals configuration once and returns the cached result. It shares Init's lock to protect Viper's package-level state during unmarshalling.

type OAuthConfig

type OAuthConfig struct {
	BaseURL string `json:"base_url" mapstructure:"base_url"`

	ClientID string `json:"client_id" mapstructure:"client_id"`

	Scopes []string `json:"scopes" mapstructure:"scopes"`

	RedirectPath string `json:"redirect_path" mapstructure:"redirect_path"`
}

OAuthConfig holds the OAuth base URL, client ID, requested scopes, and local callback path.

func (*OAuthConfig) Endpoints

func (cfg *OAuthConfig) Endpoints() *oauthEndpoints

Endpoints returns the OAuth endpoint URLs.

Jump to

Keyboard shortcuts

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