apiGetConfig handles GET /admin/api/v1/clibridge-config.
(r *http.Request)
| 27 | |
| 28 | // apiGetConfig handles GET /admin/api/v1/clibridge-config. |
| 29 | func (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. |
| 50 | func (m *CLIBridgeModule) apiPatchConfig(r *http.Request) (int, bool, any) { |
nothing calls this directly
no test coverage detected