fix(service-monitor): invalid config.metrics.TOKEN for nil and empty gitea.metrics.token
This commit is contained in:
@@ -278,7 +278,7 @@ https
|
|||||||
{{- if not (hasKey .Values.gitea.config.metrics "ENABLED") -}}
|
{{- if not (hasKey .Values.gitea.config.metrics "ENABLED") -}}
|
||||||
{{- $_ := set .Values.gitea.config.metrics "ENABLED" .Values.gitea.metrics.enabled -}}
|
{{- $_ := set .Values.gitea.config.metrics "ENABLED" .Values.gitea.metrics.enabled -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- if not (hasKey .Values.gitea.config.metrics "TOKEN") -}}
|
{{- if and (not (hasKey .Values.gitea.config.metrics "TOKEN")) (.Values.gitea.metrics.token) -}}
|
||||||
{{- $_ := set .Values.gitea.config.metrics "TOKEN" .Values.gitea.metrics.token -}}
|
{{- $_ := set .Values.gitea.config.metrics "TOKEN" .Values.gitea.metrics.token -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- /* redis queue */ -}}
|
{{- /* redis queue */ -}}
|
||||||
|
@@ -17,3 +17,29 @@ tests:
|
|||||||
value: |-
|
value: |-
|
||||||
ENABLED=true
|
ENABLED=true
|
||||||
TOKEN=somepassword
|
TOKEN=somepassword
|
||||||
|
- it: metrics token is empty
|
||||||
|
template: templates/gitea/config.yaml
|
||||||
|
set:
|
||||||
|
gitea:
|
||||||
|
metrics:
|
||||||
|
enabled: true
|
||||||
|
token: ""
|
||||||
|
asserts:
|
||||||
|
- documentIndex: 0
|
||||||
|
equal:
|
||||||
|
path: stringData.metrics
|
||||||
|
value: |-
|
||||||
|
ENABLED=true
|
||||||
|
- it: metrics token is nil
|
||||||
|
template: templates/gitea/config.yaml
|
||||||
|
set:
|
||||||
|
gitea:
|
||||||
|
metrics:
|
||||||
|
enabled: true
|
||||||
|
token:
|
||||||
|
asserts:
|
||||||
|
- documentIndex: 0
|
||||||
|
equal:
|
||||||
|
path: stringData.metrics
|
||||||
|
value: |-
|
||||||
|
ENABLED=true
|
||||||
|
Reference in New Issue
Block a user