Skip to content

Commit

Permalink
fix: need a dollar sign for the variable name (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakeyheath authored Sep 17, 2024
1 parent ee0a993 commit abf5c26
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions stack/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -191,17 +191,17 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{- $id := printf "%s_%s" ($v.method |lower) ($v.path | replace "/" "")}}
{{- $id := regexReplaceAll "\\W+" $id "_" -}}
{{- $var_name := printf "%s_%s" "skip_auth" $id }}
set {{ $var_name }} 1;
set ${{ $var_name }} 1;

if ( $request_uri !~ "{{$v.path}}" ) {
set {{ $var_name }} 0;
set ${{ $var_name }} 0;
}

if ( $request_method !~ "{{$v.method}}" ) {
set {{ $var_name }} 0;
set ${{ $var_name }} 0;
}

if ( {{ $var_name }} ) {
if ( ${{ $var_name }} ) {
return 200;
}
{{- end -}}
Expand Down
16 changes: 8 additions & 8 deletions stack/tests/ingress_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,29 +73,29 @@ tests:
equal:
path: metadata.annotations["nginx.ingress.kubernetes.io/auth-snippet"]
value: |
set skip_auth_get_healthz 1;
set $skip_auth_get_healthz 1;
if ( $request_uri !~ "/healthz" ) {
set skip_auth_get_healthz 0;
set $skip_auth_get_healthz 0;
}
if ( $request_method !~ "GET" ) {
set skip_auth_get_healthz 0;
set $skip_auth_get_healthz 0;
}
if ( skip_auth_get_healthz ) {
if ( $skip_auth_get_healthz ) {
return 200;
}
set skip_auth___api_ 1;
set $skip_auth___api_ 1;
if ( $request_uri !~ "/api/*" ) {
set skip_auth___api_ 0;
set $skip_auth___api_ 0;
}
if ( $request_method !~ "*" ) {
set skip_auth___api_ 0;
set $skip_auth___api_ 0;
}
if ( skip_auth___api_ ) {
if ( $skip_auth___api_ ) {
return 200;
}

0 comments on commit abf5c26

Please sign in to comment.