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

Method UpdateOtherConfig

agent/app/service/agents.go:1348–1384  ·  view source on GitHub ↗
(req dto.AgentOtherConfigUpdateReq)

Source from the content-addressed store, hash-verified

1346}
1347
1348func (a AgentService) UpdateOtherConfig(req dto.AgentOtherConfigUpdateReq) error {
1349 agent, install, err := a.loadAgentAndInstall(req.AgentID)
1350 if err != nil {
1351 return err
1352 }
1353 if agent.AgentType == constant.AppHermesAgent {
1354 account, err := agentAccountRepo.GetFirst(repo.WithByID(agent.AccountID))
1355 if err != nil {
1356 return err
1357 }
1358 if err := writeHermesConfig(path.Dir(agent.ConfigPath), account, agent.Model, strings.TrimSpace(req.UserTimezone)); err != nil {
1359 return err
1360 }
1361 return NewIAppInstalledService().Operate(request.AppInstalledOperate{
1362 InstallId: install.ID,
1363 Operate: constant.Restart,
1364 })
1365 }
1366 if err := ensureContainerRunning(install.ContainerName); err != nil {
1367 return err
1368 }
1369 conf, err := readOpenclawConfig(agent.ConfigPath)
1370 if err != nil {
1371 return err
1372 }
1373 setOtherConfig(conf, dto.AgentOtherConfig{
1374 UserTimezone: strings.TrimSpace(req.UserTimezone),
1375 BrowserEnabled: req.BrowserEnabled,
1376 })
1377 if err := writeOpenclawConfigRaw(agent.ConfigPath, conf); err != nil {
1378 return err
1379 }
1380 if err := setOpenclawNPMRegistry(install.ContainerName, req.NPMRegistry); err != nil {
1381 return err
1382 }
1383 return nil
1384}
1385
1386func (a AgentService) GetConfigFile(req dto.AgentConfigFileReq) (*dto.AgentConfigFile, error) {
1387 agent, _, err := a.loadAgentAndInstall(req.AgentID)

Callers

nothing calls this directly

Calls 11

loadAgentAndInstallMethod · 0.95
writeHermesConfigFunction · 0.85
NewIAppInstalledServiceFunction · 0.85
ensureContainerRunningFunction · 0.85
readOpenclawConfigFunction · 0.85
setOtherConfigFunction · 0.85
writeOpenclawConfigRawFunction · 0.85
setOpenclawNPMRegistryFunction · 0.85
GetFirstMethod · 0.65
WithByIDMethod · 0.65
OperateMethod · 0.65

Tested by

no test coverage detected