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

Method RemoveDirective

agent/utils/nginx/components/location.go:206–223  ·  view source on GitHub ↗

RemoveDirective removes a directive by its name and optional FIRST parameter match

(key string, params []string)

Source from the content-addressed store, hash-verified

204
205// RemoveDirective removes a directive by its name and optional FIRST parameter match
206func (l *Location) RemoveDirective(key string, params []string) {
207 directives := l.Directives
208 var newDirectives []IDirective
209 for _, dir := range directives {
210 if dir.GetName() == key {
211 if len(params) > 0 {
212 oldParams := dir.GetParameters()
213 if oldParams[0] == params[0] {
214 continue
215 }
216 } else {
217 continue
218 }
219 }
220 newDirectives = append(newDirectives, dir)
221 }
222 l.Directives = newDirectives
223}
224
225// RemoveDirectiveByFullParams removes a directive by its name and full parameter match
226func (l *Location) RemoveDirectiveByFullParams(key string, params []string) {

Callers 7

AddBrowserCacheMethod · 0.95
AddBroswerNoCacheMethod · 0.95
RemoveBrowserCacheMethod · 0.95
RemoveServerCacheMethod · 0.95
AddSubFilterMethod · 0.95
RemoveSubFilterMethod · 0.95
OperateProxyMethod · 0.95

Calls 2

GetNameMethod · 0.65
GetParametersMethod · 0.65

Tested by

no test coverage detected