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

Function setSecurityConfig

agent/app/service/agents_utils.go:185–195  ·  view source on GitHub ↗
(conf map[string]interface{}, config dto.AgentSecurityConfig)

Source from the content-addressed store, hash-verified

183}
184
185func setSecurityConfig(conf map[string]interface{}, config dto.AgentSecurityConfig) {
186 ensureGatewaySecurityDefaults(conf)
187 gateway := ensureChildMap(conf, "gateway")
188 controlUi := ensureChildMap(gateway, "controlUi")
189 allowedOrigins := append([]string(nil), config.AllowedOrigins...)
190 if len(allowedOrigins) > 0 {
191 controlUi["allowedOrigins"] = allowedOrigins
192 } else {
193 delete(controlUi, "allowedOrigins")
194 }
195}
196
197func ensureGatewaySecurityDefaults(conf map[string]interface{}) {
198 gateway := ensureChildMap(conf, "gateway")

Calls 2

ensureChildMapFunction · 0.85

Tested by

no test coverage detected