config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GlobalConfigDir

func GlobalConfigDir() string

GlobalConfigDir returns the path to the global config directory.

func GlobalConfigPath

func GlobalConfigPath() (string, error)

GlobalConfigPath returns the path to the global config file. Returns an error if the home directory cannot be determined.

func ResolveExtensionID

func ResolveExtensionID(flagValue string, cfg *Config) (string, error)

ResolveExtensionID returns the extension ID from the flag override or config.

func ResolveSource

func ResolveSource(argValue string, cfg *Config) string

ResolveSource returns the source path from the flag override or config.

func ValidateAuth

func ValidateAuth(cfg *Config) error

ValidateAuth checks that all required auth fields are present.

func WriteConfig

func WriteConfig(path string, cfg *Config) error

WriteConfig writes a config file to the specified path.

Types

type AuthConfig

type AuthConfig struct {
	ClientID     string `mapstructure:"client_id" toml:"client_id"`
	ClientSecret string `mapstructure:"client_secret" toml:"client_secret"`
	RefreshToken string `mapstructure:"refresh_token" toml:"refresh_token"`
}

AuthConfig holds OAuth2 credentials.

type Config

type Config struct {
	PublisherID string           `mapstructure:"publisher_id" toml:"publisher_id"`
	Auth        AuthConfig       `mapstructure:"auth" toml:"auth"`
	Extensions  ExtensionsConfig `mapstructure:"extensions" toml:"extensions,omitempty"`
}

Config holds all configuration for the CLI.

func Load

func Load() (*Config, error)

Load reads configuration from config files and environment variables. Priority: env vars > local cws.toml > global cws.toml

type ExtensionConfig

type ExtensionConfig struct {
	ID     string `mapstructure:"id" toml:"id,omitempty"`
	Source string `mapstructure:"source" toml:"source,omitempty"`
}

ExtensionConfig holds configuration for a single extension.

type ExtensionsConfig

type ExtensionsConfig struct {
	Default ExtensionConfig `mapstructure:"default" toml:"default,omitempty"`
}

ExtensionsConfig holds extension configurations (designed for multi-extension M2 support).

Jump to

Keyboard shortcuts

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