feat: handle []string or string for pathAlias
All checks were successful
Build and Push Server / build-and-push (push) Successful in 2m52s

This commit is contained in:
Max Richter
2025-10-24 11:44:57 +02:00
parent cb40a76eeb
commit 2b965cb8f7
14 changed files with 60 additions and 34 deletions

31
template/yaml_types.go Normal file
View File

@@ -0,0 +1,31 @@
package template
import "errors"
type StringOrSlice []string
func (s *StringOrSlice) UnmarshalYAML(unmarshal func(any) error) error {
var single string
if err := unmarshal(&single); err == nil {
if single == "" {
*s = nil
return nil
}
*s = []string{single}
return nil
}
var multi []string
if err := unmarshal(&multi); err == nil {
*s = multi
return nil
}
var nothing *struct{}
if err := unmarshal(&nothing); err == nil {
*s = nil
return nil
}
return errors.New("expected string, []string, or null")
}