INNER CODE UNIT · Go
LoadConfiguration
andrearaponi/dito · config/config.go:135
func LoadConfiguration(file string) (*ProxyConfig, error) {
var config ProxyConfig
data, err := os.ReadFile(file)
if err != nil {
return nil, err
}
if err = yaml.Unmarshal(data, &config); err != nil {
return nil, err
}
// Validate and set defaults
if err := validateAndSetDefaults(&config); err != nil {
return nil, fmt.Errorf("configuration validation failed: %w", err)
}
// Compile regex patterns for each location
for i, location := range config.Locations {