mirror of https://github.com/1Panel-dev/1Panel
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
654 B
29 lines
654 B
2 years ago
|
package components
|
||
|
|
||
|
type Config struct {
|
||
|
*Block
|
||
|
FilePath string
|
||
|
}
|
||
|
|
||
|
func (c *Config) FindDirectives(directiveName string) []IDirective {
|
||
|
return c.Block.FindDirectives(directiveName)
|
||
|
}
|
||
|
|
||
|
func (c *Config) FindUpstreams() []*Upstream {
|
||
|
var upstreams []*Upstream
|
||
|
directives := c.Block.FindDirectives("upstream")
|
||
|
for _, directive := range directives {
|
||
|
upstreams = append(upstreams, directive.(*Upstream))
|
||
|
}
|
||
|
return upstreams
|
||
|
}
|
||
|
|
||
|
func (c *Config) FindServers() []*Server {
|
||
|
var servers []*Server
|
||
|
directives := c.Block.FindDirectives("server")
|
||
|
for _, directive := range directives {
|
||
|
servers = append(servers, directive.(*Server))
|
||
|
}
|
||
|
return servers
|
||
|
}
|