Skip to content

Commit

Permalink
update wallet api (#330)
Browse files Browse the repository at this point in the history
  • Loading branch information
polcaparrosin2 authored Feb 5, 2025
1 parent e2864e9 commit 5786ad6
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/wallet-api/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: wallet-api
description: A Helm chart for Kubernetes
type: application
version: 1.1.2
version: 1.1.3
appVersion: "v1.2.1"

sources:
Expand Down
44 changes: 43 additions & 1 deletion charts/wallet-api/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,46 @@ Support for existing database secret
{{- else -}}
{{- printf "password" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/* Validate that the required values are set when db.externalService is true or false. */}}
{{- define "validateDatabaseConfig" -}}
{{- if .Values.db.externalService }}
{{/*Cuando externalService es verdadero, validamos los campos*/}}
{{- if empty .Values.db.host }}
{{ fail "El valor 'db.host' no puede estar vacío cuando 'db.externalService' está habilitado." }}
{{- end }}
{{- if empty .Values.db.name }}
{{ fail "El valor 'db.name' no puede estar vacío cuando 'db.externalService' está habilitado." }}
{{- end }}
{{- if empty .Values.db.schema }}
{{ fail "El valor 'db.schema' no puede estar vacío cuando 'db.externalService' está habilitado." }}
{{- end }}
{{- if empty .Values.db.username }}
{{ fail "El valor 'db.username' no puede estar vacío cuando 'db.externalService' está habilitado." }}
{{- end }}
{{- if empty .Values.db.password }}
{{ fail "El valor 'db.password' no puede estar vacío cuando 'db.externalService' está habilitado." }}
{{- end }}
{{- else }}
{{/* Cuando externalService es falso, validamos que los valores sean específicos */}}
{{- if ne .Values.db.host "wallet-postgres" }}
{{ fail "El valor 'db.host' debe ser 'localhost' cuando 'db.externalService' está deshabilitado." }}
{{- end }}
{{- if ne .Values.db.port 5432 }}
{{ fail "El valor 'db.port' debe ser '5432' cuando 'db.externalService' está deshabilitado." }}
{{- end }}
{{- if ne .Values.db.name "wallet" }}
{{ fail "El valor 'db.name' debe ser 'issuer' cuando 'db.externalService' está deshabilitado." }}
{{- end }}
{{- if ne .Values.db.schema "wallet" }}
{{ fail "El valor 'db.schema' debe ser 'public' cuando 'db.externalService' está deshabilitado." }}
{{- end }}
{{- if ne .Values.db.username "postgres" }}
{{ fail "El valor 'db.username' debe ser 'postgres' cuando 'db.externalService' está deshabilitado." }}
{{- end }}
{{- if empty .Values.db.password }}
{{ fail "El valor 'db.password' no puede estar vacío cuando 'db.externalService' está deshabilitado." }}
{{- end }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions charts/wallet-api/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ spec:
# DATABASE
- name: SPRING_R2DBC_URL
value: "r2dbc:postgresql://{{ .Values.db.host }}{{ if not .Values.db.externalService }}:{{ .Values.db.port }}{{ end }}/{{ .Values.db.name }}?schema={{ .Values.db.schema }}"
- name: DB_SCHEMA
value: {{ .Values.db.schema }}
- name: SPRING_R2DBC_USERNAME
value: {{ .Values.db.username }}
- name: SPRING_R2DBC_PASSWORD
Expand Down

0 comments on commit 5786ad6

Please sign in to comment.