MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / apiGetConfig

Method apiGetConfig

modules/clibridge/admin_api.go:29–47  ·  view source on GitHub ↗

apiGetConfig handles GET /admin/api/v1/clibridge-config.

(r *http.Request)

Source from the content-addressed store, hash-verified

27
28// apiGetConfig handles GET /admin/api/v1/clibridge-config.
29func (m *CLIBridgeModule) apiGetConfig(r *http.Request) (int, bool, any) {
30 lc := m.loadListConfig()
31
32 // Seed from overlay defaults if plugin storage is empty.
33 if len(lc.AllowedTools) == 0 {
34 lc.AllowedTools = m.getAllowedTools()
35 }
36 if len(lc.AllowedPaths) == 0 {
37 lc.AllowedPaths = m.getAllowedPaths()
38 }
39
40 enabled := m.isEnabled()
41
42 return http.StatusOK, true, map[string]any{
43 "Enabled": enabled,
44 "AllowedTools": lc.AllowedTools,
45 "AllowedPaths": lc.AllowedPaths,
46 }
47}
48
49// apiPatchConfig handles PATCH /admin/api/v1/clibridge-config.
50func (m *CLIBridgeModule) apiPatchConfig(r *http.Request) (int, bool, any) {

Callers

nothing calls this directly

Calls 4

loadListConfigMethod · 0.95
getAllowedToolsMethod · 0.95
getAllowedPathsMethod · 0.95
isEnabledMethod · 0.95

Tested by

no test coverage detected