mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 20:37:30 +00:00
how to handle decoding?
This commit is contained in:
@@ -84,11 +84,14 @@ func setField(field Updater, fields map[string]any, depth int) {
|
|||||||
Label: fmt.Sprintf("Select one of %s: (%s)", f.Name(), f.Describe()),
|
Label: fmt.Sprintf("Select one of %s: (%s)", f.Name(), f.Describe()),
|
||||||
Items: possibilities,
|
Items: possibilities,
|
||||||
}
|
}
|
||||||
i, _, err := prompt.Run()
|
i, value, err := prompt.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Println("panic", err)
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
setField(f.Fields()[i], fields, depth+1)
|
fv := fields[value]
|
||||||
|
// TODO: fv is result of decoder (postgres.config in this case)
|
||||||
|
setField(f.Fields()[i], fv.(map[string]any), depth+1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,7 +43,9 @@ func DecodeConfig(_ string, config any) (database.Connector, error) {
|
|||||||
}
|
}
|
||||||
return &Config{config}, nil
|
return &Config{config}, nil
|
||||||
case map[string]any:
|
case map[string]any:
|
||||||
return nil, errors.New("map configuration not implemented")
|
return &Config{
|
||||||
|
Config: &pgxpool.Config{},
|
||||||
|
}, nil
|
||||||
}
|
}
|
||||||
return nil, errors.New("invalid configuration")
|
return nil, errors.New("invalid configuration")
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user