config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultProfileName = "default"

Variables

This section is empty.

Functions

func AliyunConfigPath

func AliyunConfigPath(getenv func(string) string) string

func ConfigPath

func ConfigPath(getenv func(string) string) string

func EcctlConfigPath

func EcctlConfigPath(getenv func(string) string) string

func ProfileName

func ProfileName(explicit string, getenv func(string) string) string

func ResolveRegion

func ResolveRegion(explicit string, getenv func(string) string) (string, *ecerrors.AppError)

func ResolveRegionForProfile

func ResolveRegionForProfile(explicit string, profile string, configPath string, getenv func(string) string) (string, *ecerrors.AppError)

func TelemetryEnabled added in v0.2.0

func TelemetryEnabled(path string) bool

TelemetryEnabled reads the global, profile-independent telemetry switch. Missing configuration defaults to true; malformed configuration fails closed so telemetry can never make an otherwise usable CLI fail.

func ValidRegion

func ValidRegion(region string) bool

Types

type ConfigItem

type ConfigItem struct {
	Key         string   `json:"key"`
	StoredAs    string   `json:"stored_as"`
	Description string   `json:"description"`
	Value       string   `json:"value,omitempty"`
	Type        string   `json:"type"`
	Allowed     []string `json:"allowed,omitempty"`
	Sensitive   bool     `json:"sensitive,omitempty"`
	SetExample  string   `json:"set_example"`
}

func EffectiveItems

func EffectiveItems(name string, showSecret bool, ecctlConfigPath string, aliyunConfigPath string) ([]ConfigItem, error)

func SupportedItems

func SupportedItems() []ConfigItem

type ConfigValue

type ConfigValue struct {
	Key       string `json:"key"`
	Value     string `json:"value"`
	Sensitive bool   `json:"sensitive,omitempty"`
}

func ConfigValueFromProfile

func ConfigValueFromProfile(profile Profile, key string, showSecret bool) (ConfigValue, error)

func EffectiveValue

func EffectiveValue(name string, key string, showSecret bool, ecctlConfigPath string, aliyunConfigPath string) (ConfigValue, error)

type Profile

type Profile struct {
	Name            string
	Mode            string
	Region          string
	AccessKeyID     string
	AccessKeySecret string
	SecurityToken   string
	Language        string
	Output          string
}

func EffectiveProfile

func EffectiveProfile(name string, ecctlConfigPath string, aliyunConfigPath string) (Profile, bool, error)

type Store

type Store struct {
	// contains filtered or unexported fields
}

func LoadExistingStore

func LoadExistingStore(path string) (*Store, bool, error)

func LoadStore

func LoadStore(path string) (*Store, error)

func (*Store) ConfigItems

func (s *Store) ConfigItems(name string, showSecret bool) ([]ConfigItem, error)

func (*Store) Current

func (s *Store) Current() string

func (*Store) GetValue

func (s *Store) GetValue(name string, key string, showSecret bool) (ConfigValue, error)

func (*Store) Profile

func (s *Store) Profile(name string) (Profile, bool)

func (*Store) Save

func (s *Store) Save() error

func (*Store) SetCurrentProfile

func (s *Store) SetCurrentProfile(name string) error

func (*Store) SetRegion

func (s *Store) SetRegion(name string, region string) error

func (*Store) SetValue

func (s *Store) SetValue(name string, key string, value string) (ConfigValue, error)

func (*Store) UseProfile

func (s *Store) UseProfile(name string) error

Jump to

Keyboard shortcuts

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