Skip to content

Commit

Permalink
Merge pull request #25 from harness/quickfix
Browse files Browse the repository at this point in the history
fix for dbCOnnections
  • Loading branch information
arya-harness authored May 29, 2023
2 parents 12fa850 + 651b7a5 commit 4600879
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/common/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: library
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.16
version: 1.0.17

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
15 changes: 9 additions & 6 deletions src/common/templates/_databaseconnections.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@
{{- define "harnesscommon.dbconnection.mongoConnection" }}
{{- $type := "mongo" }}
{{- $hosts := (pluck $type .context.Values.global.database | first ).hosts }}
{{- $dbType := $type | upper}}
{{- $installed := (pluck $type .context.Values.global.database | first ).installed }}
{{- $protocol := (pluck $type .context.Values.global.database | first ).protocol }}
{{- $extraArgs:= (pluck $type .context.Values.global.database | first ).extraArgs }}
{{- $userVariableName := default (printf "%s_USER" $type) .userVariableName -}}
{{- $passwordVariableName := default (printf "%s_PASSWORD" $type) .passwordVariableName -}}
{{- $userVariableName := default (printf "%s_USER" $dbType) .userVariableName -}}
{{- $passwordVariableName := default (printf "%s_PASSWORD" $dbType) .passwordVariableName -}}
{{- if $installed }}
{{- $namespace := .context.Release.Namespace }}
{{- if .context.Values.global.ha -}}
Expand Down Expand Up @@ -69,8 +70,8 @@
{{- $hosts := (pluck $type .context.Values.global.database | first ).hosts }}
{{- $protocol := (pluck $type .context.Values.global.database | first ).protocol }}
{{- $installed := (pluck $type .context.Values.global.database | first).installed }}
{{- $userVariableName := default (printf "%s_USER" $type) .userVariableName -}}
{{- $passwordVariableName := default (printf "%s_PASSWORD" $type) .passwordVariableName -}}
{{- $userVariableName := default (printf "%s_USER" $dbType) .userVariableName -}}
{{- $passwordVariableName := default (printf "%s_PASSWORD" $dbType) .passwordVariableName -}}
{{- if $installed }}
{{- $connectionString := (printf "%s://$(%s_USER):$(%s_PASSWORD)@%s" "postgres" $dbType $dbType "postgres:5432") }}
{{- printf "%s" $connectionString }}
Expand Down Expand Up @@ -102,9 +103,10 @@
*/}}
{{- define "harnesscommon.dbconnection.timescaleConnection" }}
{{- $type := "timescaledb" }}
{{- $dbType := $type | upper}}
{{- $hosts := (pluck $type .context.Values.global.database | first ).hosts }}
{{- $userVariableName := default (printf "%s_USER" $type) .userVariableName -}}
{{- $passwordVariableName := default (printf "%s_PASSWORD" $type) .passwordVariableName -}}
{{- $userVariableName := default (printf "%s_USER" $dbType) .userVariableName -}}
{{- $passwordVariableName := default (printf "%s_PASSWORD" $dbType) .passwordVariableName -}}
{{- $protocol := (pluck $type .context.Values.global.database | first ).protocol }}
{{- include "harnesscommon.dbconnection.connection" (dict "type" $type "hosts" $hosts "protocol" $protocol "extraArgs" "/harness" "userVariableName" $userVariableName "passwordVariableName" $passwordVariableName) }}
{{- end}}
Expand All @@ -114,6 +116,7 @@
*/}}
{{- define "harnesscommon.dbconnection.redisEnv" }}
{{- $type := "redis" }}
{{- $dbType := $type | upper}}
{{- $passwordSecret := .context.secretName }}
{{- $passwordKey := .context.passwordKey }}
{{- $userKey := .context.userKey }}
Expand Down

0 comments on commit 4600879

Please sign in to comment.