Skip to content

Commit

Permalink
rabbitmq: allow setting protocol and vhost
Browse files Browse the repository at this point in the history
  • Loading branch information
fradeve authored and lindhe committed Nov 25, 2024
1 parent a8ef464 commit 728173d
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion charts/invenio/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,30 @@
{{- end }}
{{- end -}}

########################## RabbitMQ protocol ##########################
{{/*
This template renders the protocol for RabbitMQ.
*/}}
{{- define "invenio.rabbitmq.protocol" -}}
{{- if .Values.rabbitmq.enabled }}
{{- "amqp" }}
{{- else }}
{{- required "Missing .Values.rabbitmqExternal.protocol" .Values.rabbitmqExternal.protocol }}
{{- end }}
{{- end -}}

########################## RabbitMQ vhost ##########################
{{/*
This template renders the vhost for RabbitMQ.
*/}}
{{- define "invenio.rabbitmq.vhost" -}}
{{- if .Values.rabbitmq.enabled }}
{{- "" }}
{{- else }}
{{- required "Missing .Values.rabbitmqExternal.vhost" .Values.rabbitmqExternal.vhost }}
{{- end }}
{{- end -}}

########################## Celery broker URI ##########################
{{/*
This template renders the URI for connecting to RabbitMQ.
Expand All @@ -112,7 +136,9 @@
{{- $password := (include "invenio.rabbitmq.password" .) -}}
{{- $port := (include "invenio.rabbitmq.amqpPort" .) -}}
{{- $hostname := (include "invenio.rabbitmq.hostname" .) -}}
{{- printf "amqp://%s:%s@%s:%v/" $username $password $hostname $port }}
{{- $protocol := (include "invenio.rabbitmq.protocol" .) -}}
{{- $vhost := (include "invenio.rabbitmq.vhost" .) -}}
{{- printf "%s://%s:%s@%s:%v/%s" $protocol $username $password $hostname $port $vhost}}
{{- end -}}

########################### RabbitMQ API URI ###########################
Expand Down

0 comments on commit 728173d

Please sign in to comment.