config

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() (string, error)

DefaultPath returns the location of the config file using OS conventions.

func Save

func Save(path string, cfg *Config) error

Save persists the config to disk, creating directories as needed.

Types

type Config

type Config struct {
	DefaultProfile string `json:"defaultProfile,omitempty"`
	DefaultRegion  string `json:"defaultRegion,omitempty"`
	LastRegion     string `json:"lastRegion,omitempty"`
	LastService    string `json:"lastService,omitempty"`
}

Config represents the persisted user configuration.

func Load

func Load(path string) (*Config, error)

Load reads the config file if present; a missing file is not an error.

type Env

type Env struct {
	Profile  string
	Region   string
	Endpoint string
}

Env captures supported environment variables.

func FromEnv

func FromEnv() Env

FromEnv reads relevant AWS environment variables.

type Flags

type Flags struct {
	Profile  string
	Region   string
	Service  string
	Endpoint string
}

Flags captures CLI flag values.

type RuntimeConfig

type RuntimeConfig struct {
	Profile  string
	Region   string
	Service  string
	Endpoint string
}

RuntimeConfig resolves configuration after applying precedence rules.

func DefaultRuntime

func DefaultRuntime() RuntimeConfig

DefaultRuntime builds the runtime config when no inputs are provided.

func Resolve

func Resolve(flags Flags, env Env, cfg *Config) RuntimeConfig

Resolve merges configuration using the precedence: 1) CLI flags, 2) environment, 3) config file, 4) defaults.

Jump to

Keyboard shortcuts

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