MCPcopy Index your code
hub / github.com/zalando/skipper / CreateFilter

Method CreateFilter

script/script.go:86–111  ·  view source on GitHub ↗

CreateFilter creates the lua script filter.

(config []interface{})

Source from the content-addressed store, hash-verified

84
85// CreateFilter creates the lua script filter.
86func (ls *luaScript) CreateFilter(config []interface{}) (filters.Filter, error) {
87 if len(ls.sources) == 0 {
88 return nil, errLuaSourcesDisabled
89 }
90 if len(config) == 0 {
91 return nil, filters.ErrInvalidFilterParameters
92 }
93 src, ok := config[0].(string)
94 if !ok {
95 return nil, filters.ErrInvalidFilterParameters
96 }
97 var params []string
98 for _, p := range config[1:] {
99 ps, ok := p.(string)
100 if !ok {
101 return nil, filters.ErrInvalidFilterParameters
102 }
103 params = append(params, ps)
104 }
105
106 s := &script{source: src, routeParams: params}
107 if err := s.initScript(ls.modules, ls.sources); err != nil {
108 return nil, err
109 }
110 return s, nil
111}
112
113type script struct {
114 source string

Callers

nothing calls this directly

Calls 1

initScriptMethod · 0.80

Tested by

no test coverage detected