Skip to content

Commit

Permalink
Merge pull request #7 from onecx/feat/db-prefix-suffix
Browse files Browse the repository at this point in the history
feat: add optional prefix for database
  • Loading branch information
andrejpetras authored Oct 27, 2024
2 parents d6a9c40 + c790a5c commit 5eeb973
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
{{- define "app.db.database" -}}
{{- if .Values.db.database -}}
{{- .Values.db.database -}}
{{- else if .Values.global.db.databasePrefix -}}
{{.Values.global.db.databasePrefix}}_{{ include "app.fullname" $ | replace "-" "_" }}
{{- else -}}
{{ include "app.fullname" $ | replace "-" "_" }}
{{- end -}}
Expand Down
6 changes: 6 additions & 0 deletions tests/db-prefix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: svc
global:
db:
databasePrefix: customprefix
db:
enabled: true
1 change: 1 addition & 0 deletions tests/db.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
name: svc
db:
enabled: true
1 change: 1 addition & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ global:
db:
port:
host:
databasePrefix:

# node selector for the pods
nodeSelector:
Expand Down

0 comments on commit 5eeb973

Please sign in to comment.