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

Function NewLuaBlock

agent/utils/nginx/components/lua_block.go:15–27  ·  view source on GitHub ↗
(directive IDirective)

Source from the content-addressed store, hash-verified

13}
14
15func NewLuaBlock(directive IDirective) (*LuaBlock, error) {
16 if block := directive.GetBlock(); block != nil {
17 lb := &LuaBlock{
18 Directives: []IDirective{},
19 Name: directive.GetName(),
20 LuaCode: block.GetCodeBlock(),
21 }
22
23 lb.Directives = append(lb.Directives, block.GetDirectives()...)
24 return lb, nil
25 }
26 return nil, fmt.Errorf("%s must have a block", directive.GetName())
27}
28
29func (lb *LuaBlock) GetName() string {
30 return lb.Name

Callers

nothing calls this directly

Calls 4

GetBlockMethod · 0.65
GetNameMethod · 0.65
GetCodeBlockMethod · 0.65
GetDirectivesMethod · 0.65

Tested by

no test coverage detected