Skip to content

Commit

Permalink
add ability to set host and port with different globalctx
Browse files Browse the repository at this point in the history
  • Loading branch information
arya-harness committed Jan 11, 2025
1 parent bb0b3c8 commit 4395eb4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 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.3.75
version: 1.3.76

# 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
14 changes: 12 additions & 2 deletions src/common/templates/_databaseconnectionsv2.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -744,20 +744,30 @@ Define environment variable value based on ENABLE_ELASTIC
{{- define "harnesscommon.dbconnectionv3.postgresHost" }}
{{- $ := .context }}
{{- $connectionString := "" }}
{{- $globalDBCtx := $.Values.global.database.postgres }}
{{- if .globalDBCtx }}
{{- $globalDBCtx = .globalDBCtx }}
{{- end }}
{{- $type := "postgres" }}
{{- $localDBCtx := $.Values.postgres }}
{{- if .localDBCtx }}
{{- $localDBCtx = .localDBCtx }}
{{- end }}
{{- $installed := and ( (pluck $type $.Values.global.database | first).installed ) (not $localDBCtx.enabled) }}
{{- $installed := false }}
{{- if eq $globalDBCtx.installed true }}
{{- $installed = $globalDBCtx.installed }}
{{- end }}
{{- if eq $localDBCtx.enabled true }}
{{- $installed = false }}
{{- end }}
{{- if $installed }}
{{- print "postgres" }}
{{- else }}
{{- $hosts := list }}
{{- if gt (len $localDBCtx.hosts) 0 }}
{{- $hosts = $localDBCtx.hosts }}
{{- else }}
{{- $hosts = $.Values.global.database.postgres.hosts }}
{{- $hosts = $globalDBCtx.hosts }}
{{- end }}
{{- printf "%s" (split ":" (index $hosts 0))._0 }}
{{- end }}
Expand Down

0 comments on commit 4395eb4

Please sign in to comment.