Skip to content

Commit

Permalink
kimai - mandatory serverVersion parameter to DATABASE_URL
Browse files Browse the repository at this point in the history
  • Loading branch information
hw-rjuzak committed Nov 15, 2023
1 parent 99a5d1e commit 2f50b34
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
26 changes: 19 additions & 7 deletions charts/kimai2/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Return the kimai Secret Name
{{- end -}}

{{/*
Return the MariaDB Hostname
Return the Database Hostname
*/}}
{{- define "kimai.databaseHost" -}}
{{- if .Values.mariadb.enabled }}
Expand All @@ -66,9 +66,10 @@ Return the MariaDB Hostname
{{- printf "%s" .Values.externalDatabase.host -}}
{{- end -}}
{{- end -}}
{{/*
{{/*
Return the MariaDB Port
Return the Database Port
*/}}
{{- define "kimai.databasePort" -}}
{{- if .Values.mariadb.enabled }}
Expand All @@ -79,7 +80,18 @@ Return the MariaDB Port
{{- end -}}

{{/*
Return the MariaDB Database Name
Return the Database ServerVersion
*/}}
{{- define "kimai.databaseServerVersion" -}}
{{- if .Values.mariadb.enabled }}
{{- printf "%s" (regexReplaceAll "-.*$" .Values.mariadb.image.tag "") -}}
{{- else -}}
{{- printf "%d" (.Values.externalDatabase.port | int ) -}}
{{- end -}}
{{- end -}}

{{/*
Return the Database Name
*/}}
{{- define "kimai.databaseName" -}}
{{- if .Values.mariadb.enabled }}
Expand All @@ -90,7 +102,7 @@ Return the MariaDB Database Name
{{- end -}}

{{/*
Return the MariaDB User
Return the Database User
*/}}
{{- define "kimai.databaseUser" -}}
{{- if .Values.mariadb.enabled }}
Expand All @@ -101,7 +113,7 @@ Return the MariaDB User
{{- end -}}

{{/*
Return the MariaDB Password
Return the Database Password
*/}}
{{- define "kimai.databasePassword" -}}
{{- if .Values.mariadb.enabled }}
Expand All @@ -112,8 +124,8 @@ Return the MariaDB Password
{{- end -}}

{{/*
Create the database URL. For the time being, this supports only an integrated MySQL
Create the Database URL. For the time being, this supports only an integrated MySQL
*/}}
{{- define "kimai.databaseUrl" -}}
mysql://{{ include "kimai.databaseUser" . }}:{{ include "kimai.databasePassword" . }}@{{ include "kimai.databaseHost" . }}/{{ include "kimai.databaseName" . }}
mysql://{{ include "kimai.databaseUser" . }}:{{ include "kimai.databasePassword" . }}@{{ include "kimai.databaseHost" . }}/{{ include "kimai.databaseName" . }}?charset=utf8&serverVersion={{ include "kimai.databaseServerVersion" . }}
{{- end }}
3 changes: 3 additions & 0 deletions charts/kimai2/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,9 @@ externalDatabase:
## @param externalDatabase.port External Database server port
##
port: 3306
## @param externalDatabase.serverVersion External Database server version
##
serverVersion: '5.7'
## @param externalDatabase.user External Database username
##
user: kimai
Expand Down

0 comments on commit 2f50b34

Please sign in to comment.