Skip to content

Commit

Permalink
Merge pull request #87 from dakshinai/allow-js_shared_dict_zone
Browse files Browse the repository at this point in the history
Allow directive js_shared_dict_zone
  • Loading branch information
dakshinai authored May 17, 2024
2 parents c2fcbc0 + b8a4efb commit 5a931e2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
4 changes: 4 additions & 0 deletions analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -2262,6 +2262,10 @@ var directives = map[string][]uint{
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake2,
ngxStreamMainConf | ngxStreamSrvConf | ngxConfTake2,
},
"js_shared_dict_zone": {
ngxHTTPMainConf | ngxConf1More,
ngxStreamMainConf | ngxConf1More,
},
"js_var": {
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake12,
ngxStreamMainConf | ngxStreamSrvConf | ngxConfTake12,
Expand Down
27 changes: 27 additions & 0 deletions analyze_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,33 @@ func TestAnalyze_njs(t *testing.T) {
blockCtx{"stream"},
true,
},
"js_shared_dict_zone in http context ok": {
&Directive{
Directive: "js_shared_dict_zone",
Args: []string{"zone=foo:1M"},
Line: 5,
},
blockCtx{"http"},
false,
},
"js_shared_dict_zone in stream context ok": {
&Directive{
Directive: "js_shared_dict_zone",
Args: []string{"zone=foo:1M"},
Line: 5,
},
blockCtx{"stream"},
false,
},
"js_shared_dict_zone not ok": {
&Directive{
Directive: "js_shared_dict_zone",
Args: []string{"zone=foo:1M"},
Line: 5,
},
blockCtx{"http", "location"},
true,
},
}

for name, tc := range testcases {
Expand Down

0 comments on commit 5a931e2

Please sign in to comment.