Skip to content

Commit ef0735b

Browse files
fradeveegabancho
authored andcommitted
rabbitmq: allow setting protocol and vhost
1 parent 358aeed commit ef0735b

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

charts/invenio/templates/_helpers.tpl

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,30 @@
103103
{{- end }}
104104
{{- end -}}
105105

106+
########################## RabbitMQ protocol ##########################
107+
{{/*
108+
This template renders the protocol for RabbitMQ.
109+
*/}}
110+
{{- define "invenio.rabbitmq.protocol" -}}
111+
{{- if .Values.rabbitmq.enabled }}
112+
{{- "amqp" }}
113+
{{- else }}
114+
{{- required "Missing .Values.rabbitmqExternal.protocol" .Values.rabbitmqExternal.protocol }}
115+
{{- end }}
116+
{{- end -}}
117+
118+
########################## RabbitMQ vhost ##########################
119+
{{/*
120+
This template renders the vhost for RabbitMQ.
121+
*/}}
122+
{{- define "invenio.rabbitmq.vhost" -}}
123+
{{- if .Values.rabbitmq.enabled }}
124+
{{- "" }}
125+
{{- else }}
126+
{{- required "Missing .Values.rabbitmqExternal.vhost" .Values.rabbitmqExternal.vhost }}
127+
{{- end }}
128+
{{- end -}}
129+
106130
########################## Celery broker URI ##########################
107131
{{/*
108132
This template renders the URI for connecting to RabbitMQ.
@@ -112,7 +136,9 @@
112136
{{- $password := (include "invenio.rabbitmq.password" .) -}}
113137
{{- $port := (include "invenio.rabbitmq.amqpPort" .) -}}
114138
{{- $hostname := (include "invenio.rabbitmq.hostname" .) -}}
115-
{{- printf "amqp://%s:%s@%s:%v/" $username $password $hostname $port }}
139+
{{- $protocol := (include "invenio.rabbitmq.protocol" .) -}}
140+
{{- $vhost := (include "invenio.rabbitmq.vhost" .) -}}
141+
{{- printf "%s://%s:%s@%s:%v/%s" $protocol $username $password $hostname $port $vhost}}
116142
{{- end -}}
117143

118144
########################### RabbitMQ API URI ###########################

0 commit comments

Comments
 (0)