(req dto.AgentSecurityConfigUpdateReq)
| 1292 | } |
| 1293 | |
| 1294 | func (a AgentService) UpdateSecurityConfig(req dto.AgentSecurityConfigUpdateReq) error { |
| 1295 | agent, install, err := a.loadOpenclawAgentAndInstall(req.AgentID) |
| 1296 | if err != nil { |
| 1297 | return err |
| 1298 | } |
| 1299 | allowedOrigins, err := normalizeAllowedOrigins(req.AllowedOrigins) |
| 1300 | if err != nil { |
| 1301 | return err |
| 1302 | } |
| 1303 | if len(allowedOrigins) == 0 { |
| 1304 | return fmt.Errorf("allowed origins is required") |
| 1305 | } |
| 1306 | conf, err := readOpenclawConfig(agent.ConfigPath) |
| 1307 | if err != nil { |
| 1308 | return err |
| 1309 | } |
| 1310 | setSecurityConfig(conf, dto.AgentSecurityConfig{AllowedOrigins: allowedOrigins}) |
| 1311 | if err := writeOpenclawConfigRaw(agent.ConfigPath, conf); err != nil { |
| 1312 | return err |
| 1313 | } |
| 1314 | if err := syncOpenclawAllowedOriginEnv(install, allowedOrigins); err != nil { |
| 1315 | return err |
| 1316 | } |
| 1317 | return appInstallRepo.Save(context.Background(), install) |
| 1318 | } |
| 1319 | |
| 1320 | func (a AgentService) GetOtherConfig(req dto.AgentIDReq) (*dto.AgentOtherConfig, error) { |
| 1321 | agent, install, err := a.loadAgentAndInstall(req.AgentID) |
nothing calls this directly
no test coverage detected