MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / UpdateSecurityConfig

Method UpdateSecurityConfig

agent/app/service/agents.go:1294–1318  ·  view source on GitHub ↗
(req dto.AgentSecurityConfigUpdateReq)

Source from the content-addressed store, hash-verified

1292}
1293
1294func (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
1320func (a AgentService) GetOtherConfig(req dto.AgentIDReq) (*dto.AgentOtherConfig, error) {
1321 agent, install, err := a.loadAgentAndInstall(req.AgentID)

Callers

nothing calls this directly

Calls 7

normalizeAllowedOriginsFunction · 0.85
readOpenclawConfigFunction · 0.85
setSecurityConfigFunction · 0.85
writeOpenclawConfigRawFunction · 0.85
SaveMethod · 0.65

Tested by

no test coverage detected