mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-14 15:37:07 +08:00
bump compose-go to v2.2.0
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
This commit is contained in:
26
vendor/github.com/compose-spec/compose-go/v2/loader/loader.go
generated
vendored
26
vendor/github.com/compose-spec/compose-go/v2/loader/loader.go
generated
vendored
@ -738,7 +738,9 @@ func Transform(source interface{}, target interface{}) error {
|
||||
DecodeHook: mapstructure.ComposeDecodeHookFunc(
|
||||
nameServices,
|
||||
decoderHook,
|
||||
cast),
|
||||
cast,
|
||||
secretConfigDecoderHook,
|
||||
),
|
||||
Result: target,
|
||||
TagName: "yaml",
|
||||
Metadata: &data,
|
||||
@ -764,6 +766,28 @@ func nameServices(from reflect.Value, to reflect.Value) (interface{}, error) {
|
||||
return from.Interface(), nil
|
||||
}
|
||||
|
||||
func secretConfigDecoderHook(from, to reflect.Type, data interface{}) (interface{}, error) {
|
||||
// Check if the input is a map and we're decoding into a SecretConfig
|
||||
if from.Kind() == reflect.Map && to == reflect.TypeOf(types.SecretConfig{}) {
|
||||
if v, ok := data.(map[string]interface{}); ok {
|
||||
if ext, ok := v["#extensions"].(map[string]interface{}); ok {
|
||||
if val, ok := ext[types.SecretConfigXValue].(string); ok {
|
||||
// Return a map with the Content field populated
|
||||
v["Content"] = val
|
||||
delete(ext, types.SecretConfigXValue)
|
||||
|
||||
if len(ext) == 0 {
|
||||
delete(v, "#extensions")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Return the original data so the rest is handled by default mapstructure logic
|
||||
return data, nil
|
||||
}
|
||||
|
||||
// keys need to be converted to strings for jsonschema
|
||||
func convertToStringKeysRecursive(value interface{}, keyPrefix string) (interface{}, error) {
|
||||
if mapping, ok := value.(map[string]interface{}); ok {
|
||||
|
Reference in New Issue
Block a user