Skip to content

Commit d1ab027

Browse files
authored
Merge branch 'main' into main
2 parents 9deec04 + 6bf177f commit d1ab027

File tree

4 files changed

+62
-4
lines changed

4 files changed

+62
-4
lines changed

analyze.go

+28-3
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,13 @@ var directives = map[string][]uint{
265265
"auth_http": {
266266
ngxMailMainConf | ngxMailSrvConf | ngxConfTake1,
267267
},
268-
"auth_Httpheader": {
268+
"auth_http_header": {
269269
ngxMailMainConf | ngxMailSrvConf | ngxConfTake2,
270270
},
271-
"auth_Httppass_client_cert": {
271+
"auth_http_pass_client_cert": {
272272
ngxMailMainConf | ngxMailSrvConf | ngxConfFlag,
273273
},
274-
"auth_Httptimeout": {
274+
"auth_http_timeout": {
275275
ngxMailMainConf | ngxMailSrvConf | ngxConfTake1,
276276
},
277277
"auth_request": {
@@ -922,6 +922,9 @@ var directives = map[string][]uint{
922922
"master_process": {
923923
ngxMainConf | ngxDirectConf | ngxConfFlag,
924924
},
925+
"max_errors": {
926+
ngxMailMainConf | ngxMailSrvConf | ngxConfTake1,
927+
},
925928
"max_ranges": {
926929
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake1,
927930
},
@@ -1010,6 +1013,24 @@ var directives = map[string][]uint{
10101013
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake1234,
10111014
ngxStreamMainConf | ngxStreamSrvConf | ngxConfTake1234,
10121015
},
1016+
"otel_exporter": {
1017+
ngxHTTPMainConf | ngxConfBlock | ngxConfNoArgs,
1018+
},
1019+
"otel_service_name": {
1020+
ngxHTTPMainConf | ngxConfTake1,
1021+
},
1022+
"otel_span_attr": {
1023+
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake2,
1024+
},
1025+
"otel_span_name": {
1026+
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake1,
1027+
},
1028+
"otel_trace": {
1029+
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake1,
1030+
},
1031+
"otel_trace_context": {
1032+
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake1,
1033+
},
10131034
"output_buffers": {
10141035
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake2,
10151036
},
@@ -1205,6 +1226,7 @@ var directives = map[string][]uint{
12051226
},
12061227
"proxy_protocol": {
12071228
ngxStreamMainConf | ngxStreamSrvConf | ngxConfFlag,
1229+
ngxMailMainConf | ngxMailSrvConf | ngxConfFlag,
12081230
},
12091231
"proxy_protocol_timeout": {
12101232
ngxStreamMainConf | ngxStreamSrvConf | ngxConfTake1,
@@ -1236,6 +1258,9 @@ var directives = map[string][]uint{
12361258
"proxy_set_header": {
12371259
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfTake2,
12381260
},
1261+
"proxy_smtp_auth": {
1262+
ngxMailMainConf | ngxMailSrvConf | ngxConfFlag,
1263+
},
12391264
"proxy_socket_keepalive": {
12401265
ngxHTTPMainConf | ngxHTTPSrvConf | ngxHTTPLocConf | ngxConfFlag,
12411266
ngxStreamMainConf | ngxStreamSrvConf | ngxConfFlag,

analyze_map.go

+3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ var mapBodies = map[string]mapParameterMasks{
4141
"geoip2": {
4242
defaultMasks: ngxConf1More,
4343
},
44+
"otel_exporter": {
45+
defaultMasks: ngxConfTake1,
46+
},
4447
}
4548

4649
// analyzeMapBody validates the body of a map-like directive. Map-like directives are block directives

analyze_map_test.go

+21
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,27 @@ func TestAnalyzeMapBody(t *testing.T) {
175175
},
176176
term: ";",
177177
},
178+
"valid otel_exporter": {
179+
mapDirective: "otel_exporter",
180+
parameter: &Directive{
181+
Directive: "endpoint",
182+
Args: []string{"localhost:4317"},
183+
Line: 5,
184+
Block: Directives{},
185+
},
186+
term: ";",
187+
},
188+
"invalid otel_exporter": {
189+
mapDirective: "otel_exporter",
190+
parameter: &Directive{
191+
Directive: "endpoint",
192+
Args: []string{"localhost:4317", "localhost:1234"},
193+
Line: 5,
194+
Block: Directives{},
195+
},
196+
term: ";",
197+
wantErr: &ParseError{What: "invalid number of parameters", BlockCtx: "otel_exporter"},
198+
},
178199
"missing semicolon": {
179200
mapDirective: "map",
180201
parameter: &Directive{

analyze_test.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ func TestAnalyze_njs(t *testing.T) {
234234
blockCtx{"http", "location"},
235235
false,
236236
},
237-
"js_periodic not ok in http": {
237+
"js_periodic not ok in http if": {
238238
&Directive{
239239
Directive: "js_periodic",
240240
Args: []string{"function"},
@@ -252,6 +252,15 @@ func TestAnalyze_njs(t *testing.T) {
252252
blockCtx{"stream", "server"},
253253
false,
254254
},
255+
"js_periodic not ok in stream": {
256+
&Directive{
257+
Directive: "js_periodic",
258+
Args: []string{"function"},
259+
Line: 5,
260+
},
261+
blockCtx{"stream"},
262+
true,
263+
},
255264
}
256265

257266
for name, tc := range testcases {

0 commit comments

Comments
 (0)