config

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDurationFromViper

func GetDurationFromViper(v *viper.Viper, key string, defaultValue time.Duration) time.Duration

GetDurationFromViper safely extracts a duration from viper, handling both duration strings and integer seconds.

func SetupViper

func SetupViper(configName string, configPaths []string, defaults map[string]interface{}) (*viper.Viper, error)

SetupViper creates and configures a new Viper instance for loading test configuration. configName: name of the config file (e.g., ".env") configPaths: paths to search for the config file defaults: default values to set

func ValidateRequiredFields

func ValidateRequiredFields(required map[string]string) error

ValidateRequiredFields checks that all required configuration values are set. Takes a map of environment variable names to their values. Returns an Error if any required fields are missing.

Types

type BaseConfig

type BaseConfig struct {
	BaseURL         string
	AuthToken       string
	RequestTimeout  time.Duration
	TestTimeout     time.Duration
	SkipIntegration bool
	DebugLogging    bool
	LogRequests     bool
	LogResponses    bool
}

BaseConfig contains the base configuration fields common across all API test clients. Services should embed this struct and add service-specific fields.

func NewBaseConfig

func NewBaseConfig() *BaseConfig

NewBaseConfig creates a new BaseConfig with default values.

type Error

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

Error represents a configuration error with missing fields.

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

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