Fix bd-yuf7: Add config to bd info JSON output
- bd info now includes config in JSON output - Temporarily switches to direct mode to read config table - Fixes issue where bd config set worked but bd info showed null config Amp-Thread-ID: https://ampcode.com/threads/T-d2e6a5e4-7f85-4e9f-94bb-d20ea46ea13b Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -86,6 +86,28 @@ Examples:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add config to info output (requires direct mode to access config table)
|
||||||
|
// Save current daemon state
|
||||||
|
wasDaemon := daemonClient != nil
|
||||||
|
var tempErr error
|
||||||
|
|
||||||
|
if wasDaemon {
|
||||||
|
// Temporarily switch to direct mode to read config
|
||||||
|
tempErr = ensureDirectMode("info: reading config")
|
||||||
|
}
|
||||||
|
|
||||||
|
if store != nil {
|
||||||
|
ctx := context.Background()
|
||||||
|
configMap, err := store.GetAllConfig(ctx)
|
||||||
|
if err == nil && len(configMap) > 0 {
|
||||||
|
info["config"] = configMap
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note: We don't restore daemon mode since info is a read-only command
|
||||||
|
// and the process will exit immediately after this
|
||||||
|
_ = tempErr // silence unused warning
|
||||||
|
|
||||||
// Add schema information if requested
|
// Add schema information if requested
|
||||||
if schemaFlag && store != nil {
|
if schemaFlag && store != nil {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|||||||
Reference in New Issue
Block a user