Documentation
¶
Overview ¶
Package config provides centralized configuration management for the refresh CLI tool. It handles environment variables, defaults, and validation using clean code patterns.
Index ¶
Constants ¶
const ( // DefaultTimeout is the default operation timeout for API calls. DefaultTimeout = 60 * time.Second // DefaultMaxConcurrency is the default maximum number of concurrent operations. DefaultMaxConcurrency = 8 // DefaultPollInterval is the default interval for polling update status. DefaultPollInterval = 15 * time.Second // DefaultUpdateTimeout is the default timeout for AMI update operations. DefaultUpdateTimeout = 40 * time.Minute // DefaultCacheTTL is the default time-to-live for cached data. DefaultCacheTTL = 5 * time.Minute // DefaultListCacheTTL is the TTL for list operation cache. DefaultListCacheTTL = 2 * time.Minute )
Default configuration values following Go best practices for constants.
const ( EnvTimeout = "REFRESH_TIMEOUT" EnvMaxConcurrency = "REFRESH_MAX_CONCURRENCY" EnvEKSRegions = "REFRESH_EKS_REGIONS" EnvClusterName = "EKS_CLUSTER_NAME" EnvKubeconfig = "KUBECONFIG" EnvAWSRegion = "AWS_REGION" EnvAWSProfile = "AWS_PROFILE" )
Environment variable names as constants for type safety and refactoring.
Variables ¶
This section is empty.
Functions ¶
func ChinaRegions ¶ added in v0.4.1
func ChinaRegions() []string
ChinaRegions returns the list of EKS-supported China regions.
func DefaultEKSRegions ¶ added in v0.4.1
func DefaultEKSRegions() []string
DefaultEKSRegions returns the default list of EKS-supported regions for the commercial AWS partition.
func GetRegionsForPartition ¶ added in v0.4.1
GetRegionsForPartition returns the appropriate regions based on the current AWS partition detected from the provided region.
func GovCloudRegions ¶ added in v0.4.1
func GovCloudRegions() []string
GovCloudRegions returns the list of EKS-supported GovCloud regions.
func RegionsFromEnv ¶
func RegionsFromEnv() []string
RegionsFromEnv parses REFRESH_EKS_REGIONS environment variable (comma-separated). Returns nil if the environment variable is not set or empty.
Types ¶
type Config ¶ added in v0.4.1
type Config struct {
Timeout time.Duration
MaxConcurrency int
Regions []string
ClusterName string
Kubeconfig string
// contains filtered or unexported fields
}
Config holds all runtime configuration loaded from environment and defaults. It is thread-safe through the use of sync.RWMutex.
func Get ¶ added in v0.4.1
func Get() *Config
Get returns the global configuration instance, initializing it if necessary. This function is thread-safe and follows the singleton pattern.
func (*Config) GetMaxConcurrency ¶ added in v0.4.1
GetMaxConcurrency returns the configured max concurrency in a thread-safe manner.
func (*Config) GetRegions ¶ added in v0.4.1
GetRegions returns the configured regions in a thread-safe manner.
func (*Config) GetTimeout ¶ added in v0.4.1
GetTimeout returns the configured timeout value in a thread-safe manner.
func (*Config) SetMaxConcurrency ¶ added in v0.4.1
SetMaxConcurrency updates the max concurrency in a thread-safe manner.
func (*Config) SetTimeout ¶ added in v0.4.1
SetTimeout updates the timeout value in a thread-safe manner.