Documentation
¶
Index ¶
- Constants
- Variables
- func GetInfraspecCloudToken() (string, error)
- func GetUserConfigPath() (string, error)
- func SaveUserConfig(userConfig *UserConfig) error
- func UseInfraspecVirtualCloud() bool
- type CleanupConfig
- type Config
- type Functions
- type RandomStringConfig
- type RetryConfig
- type StepDefinition
- type TelemetryConfig
- type UserConfig
Constants ¶
const ( // InfraspecCloudTokenEnvVar is the environment variable name for the InfraSpec Cloud token InfraspecCloudTokenEnvVar = "INFRASPEC_CLOUD_TOKEN" // UseInfraspecVirtualCloudEnvVar enables InfraSpec Cloud virtual cloud mode when set to a truthy value. UseInfraspecVirtualCloudEnvVar = "USE_INFRASPEC_VIRTUAL_CLOUD" // ConfigFileName is the name of the user config file ConfigFileName = "config.yaml" )
Variables ¶
var ( // Logging is the public interface to logging Logging = &logging{ AtomicLogLevel: zap.NewAtomicLevel(), DefaultLogLevel: zap.InfoLevel, } )
Functions ¶
func GetInfraspecCloudToken ¶ added in v0.1.0
GetInfraspecCloudToken returns the InfraSpec Cloud token from config or environment variable Environment variable takes precedence over config file
func GetUserConfigPath ¶ added in v0.1.0
GetUserConfigPath returns the path to the user config file
func SaveUserConfig ¶ added in v0.1.0
func SaveUserConfig(userConfig *UserConfig) error
SaveUserConfig saves the user configuration to the config file
func UseInfraspecVirtualCloud ¶ added in v0.1.0
func UseInfraspecVirtualCloud() bool
UseInfraspecVirtualCloud returns true if InfraSpec Virtual Cloud is enabled.
Types ¶
type CleanupConfig ¶
type CleanupConfig struct {
Automatic bool `yaml:"automatic"`
Timeout int `yaml:"timeout"`
Strategy string `yaml:"strategy"` // eager or deferred
Retries RetryConfig `yaml:"retries"`
}
CleanupConfig defines cleanup behavior
type Config ¶
type Config struct {
Version string `yaml:"version"`
Provider string `yaml:"provider"`
StepDefinitions []StepDefinition `yaml:"step_definitions"`
Functions Functions `yaml:"functions"`
Cleanup CleanupConfig `yaml:"cleanup"`
Retries RetryConfig `yaml:"retries"`
Verbose bool `yaml:"verbose"` // Enable verbose mode
Debug bool `yaml:"debug"` // Enable debug mode
Telemetry TelemetryConfig `yaml:"telemetry"`
VirtualCloud bool `yaml:"virtual_cloud"`
ParallelMode bool `yaml:"-"` // Runtime flag for parallel execution, not persisted
}
Config represents the main configuration structure
func Current ¶ added in v0.1.0
func Current() *Config
Current returns the most recently loaded configuration.
func LoadConfig ¶ added in v0.1.0
LoadConfig loads configuration from disk, applying default values and overrides from environment variables and the virtual cloud CLI flag. If the config file is missing, only the defaults are used.
type Functions ¶
type Functions struct {
RandomString RandomStringConfig `yaml:"random_string"`
}
Functions contains configuration for various utility functions
type RandomStringConfig ¶
RandomStringConfig configures random string generation
type RetryConfig ¶
type RetryConfig struct {
MaxAttempts int `yaml:"max_attempts"`
Delay time.Duration `yaml:"delay"`
MaxDelay time.Duration `yaml:"max_delay"`
BackoffFactor float64 `yaml:"backoff_factor"`
RetryableErrors []string `yaml:"retryable_errors"`
}
RetryConfig defines retry behavior
type StepDefinition ¶
type StepDefinition struct {
Pattern string `yaml:"pattern"`
StoreAs string `yaml:"store_as,omitempty"`
DataTable bool `yaml:"data_table,omitempty"`
Parameters map[string]string `yaml:"parameters,omitempty"`
}
StepDefinition defines a mapping between Gherkin steps and actions
type TelemetryConfig ¶
type TelemetryConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
UserID string `yaml:"user_id" json:"user_id"`
}
TelemetryConfig holds telemetry-related configuration
func LoadTelemetryConfig ¶
func LoadTelemetryConfig() TelemetryConfig
LoadTelemetryConfig loads telemetry configuration from environment and config
type UserConfig ¶ added in v0.1.0
type UserConfig struct {
InfraspecCloudToken string `yaml:"infraspec_cloud_token,omitempty"`
}
UserConfig represents user-specific configuration
func LoadUserConfig ¶ added in v0.1.0
func LoadUserConfig() (*UserConfig, error)
LoadUserConfig loads the user configuration from the config file