Skip to content

Commit

Permalink
Merge pull request #22 from harness/SMP-1274
Browse files Browse the repository at this point in the history
[SMP-1274]: fix mongo uri helper functions for multiple hosts
  • Loading branch information
harness-jc committed May 11, 2023
2 parents 4b4721c + 151d1a6 commit caf7431
Show file tree
Hide file tree
Showing 3 changed files with 25 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.12
version: 1.0.13

# 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
23 changes: 22 additions & 1 deletion src/common/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
# harness-common

![Version: 1.0.3](https://img.shields.io/badge/Version-1.0.3-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) ![AppVersion: 0.0.0](https://img.shields.io/badge/AppVersion-0.0.0-informational?style=flat-square)
![Version: 1.0.13](https://img.shields.io/badge/Version-1.0.13-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) ![AppVersion: 0.0.0](https://img.shields.io/badge/AppVersion-0.0.0-informational?style=flat-square)

Helm Common library for Harness Helm Charts

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| global.database.mongo.extraArgs | string | `""` | |
| global.database.mongo.hosts | list | `[]` | |
| global.database.mongo.installed | bool | `true` | |
| global.database.mongo.passwordKey | string | `""` | |
| global.database.mongo.protocol | string | `"mongodb"` | |
| global.database.mongo.secretName | string | `""` | |
| global.database.mongo.userKey | string | `""` | |
| global.database.postgres.extraArgs | string | `""` | |
| global.database.postgres.hosts[0] | string | `"postgres:5432"` | |
| global.database.postgres.installed | bool | `true` | |
| global.database.postgres.passwordKey | string | `""` | |
| global.database.postgres.protocol | string | `"postgres"` | |
| global.database.postgres.secretName | string | `""` | |
| global.database.postgres.userKey | string | `""` | |
| global.database.timescaledb.extraArgs | string | `""` | |
| global.database.timescaledb.hosts[0] | string | `"timescaledb-single-chart:5432"` | |
| global.database.timescaledb.installed | bool | `true` | |
| global.database.timescaledb.passwordKey | string | `""` | |
| global.database.timescaledb.protocol | string | `"jdbc:postgresql"` | |
| global.database.timescaledb.secretName | string | `""` | |
| global.database.timescaledb.userKey | string | `""` | |
| global.ha | bool | `false` | |

----------------------------------------------
Expand Down
7 changes: 2 additions & 5 deletions src/common/templates/_databasehelpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@
{{- $protocol := .protocol }}
{{- $extraArgs := .extraArgs }}
{{- $connectionString := (printf "%s://$(%s_USER):$(%s_PASSWORD)@%s" $protocol $dbType $dbType $firsthost) }}
{{- if $extraArgs }}
{{- $connectionString = (printf "%s%s" $connectionString $extraArgs ) }}
{{- end }}
{{- range $host := (rest .hosts) }}
{{- $connectionString = printf "%s,%s://$(%s_USER):$(%s_PASSWORD)@%s" $connectionString $protocol $dbType $dbType $host }}
{{- $connectionString = printf "%s,%s" $connectionString $host }}
{{- end}}
{{- if $extraArgs }}
{{- $connectionString = (printf "%s%s" $connectionString $extraArgs ) }}
{{- end }}
{{- end}}
{{- printf "%s" $connectionString }}
{{- end }}

0 comments on commit caf7431

Please sign in to comment.