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

Method FindDirectives

agent/utils/nginx/components/server.go:92–116  ·  view source on GitHub ↗
(directiveName string)

Source from the content-addressed store, hash-verified

90}
91
92func (s *Server) FindDirectives(directiveName string) []IDirective {
93 directives := make([]IDirective, 0)
94 for _, directive := range s.Directives {
95 if directive.GetName() == directiveName {
96 directives = append(directives, directive)
97 }
98 if directive.GetBlock() != nil {
99 directives = append(directives, directive.GetBlock().FindDirectives(directiveName)...)
100 }
101 }
102 if directiveName == "listen" {
103 for _, listen := range s.Listens {
104 params := []string{listen.Bind}
105 params = append(params, listen.Parameters...)
106 if listen.DefaultServer != "" {
107 params = append(params, DefaultServer)
108 }
109 directives = append(directives, &Directive{
110 Name: "listen",
111 Parameters: params,
112 })
113 }
114 }
115 return directives
116}
117
118func (s *Server) UpdateDirective(key string, params []string) {
119 if key == "" || len(params) == 0 {

Callers 3

DeleteServerNameMethod · 0.95
AddServerNameMethod · 0.95
getRootProxyDirectivesFunction · 0.95

Calls 3

GetNameMethod · 0.65
GetBlockMethod · 0.65
FindDirectivesMethod · 0.65

Tested by

no test coverage detected