matrix-synapse: Support MSC1929/extra .well-known

This commit is contained in:
Alexander Olofsson 2022-08-03 17:52:01 +02:00
parent 47dd79bec1
commit 450ef8591c
No known key found for this signature in database
GPG key ID: D439C9470CB04C73
4 changed files with 34 additions and 23 deletions

View file

@ -164,39 +164,27 @@ spec:
{{- if has . $wkHosts }}
{{- if $.Values.wellknown.enabled }}
- path: /.well-known/matrix/client
- path: /.well-known/matrix
backend:
{{- if $v1Ingress }}
service:
name: {{ $wkName }}
port:
number: 80
pathType: Exact
{{- else }}
serviceName: {{ $wkName }}
servicePort: 80
{{- end }}
- path: /.well-known/matrix/server
backend:
{{- if $v1Ingress }}
service:
name: {{ $wkName }}
port:
number: 80
pathType: Exact
pathType: Prefix
{{- else }}
serviceName: {{ $wkName }}
servicePort: 80
{{- end }}
{{- else }}
- path: /.well-known/matrix/client
- path: /.well-known/matrix
backend:
{{- if $v1Ingress }}
service:
name: {{ $fullName }}
port:
number: {{ $.Values.service.port }}
pathType: Exact
pathType: Prefix
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $.Values.service.port }}

View file

@ -27,8 +27,11 @@ data:
server.document-root = {{ .Values.wellknown.htdocsPath | quote }}
server.pid-file = "/run/lighttpd.pid"
url.rewrite-once = (
"^/\.well-known/matrix/client" => "/client.json",
"^/\.well-known/matrix/server" => "/server.json"
{{- $keys := concat (list "client" "server") (keys .Values.wellknown.extraData) }}
{{- range $key := initial $keys }}
"^/\.well-known/matrix/{{ $key }}" => "/{{ $key }}.json",
{{- end }}
"^/\.well-known/matrix/{{ last $keys }}" => "/{{ last $keys }}.json"
)
status.status-url = "/server-status"
extforward.forwarder = ( "all" => "trust")
@ -52,4 +55,12 @@ data:
{{- else }}
{{ dict "m.homeserver" (dict "base_url" (printf "https://%s/" (.Values.publicServerName | default .Values.serverName))) | toJson | indent 4 }}
{{- end }}
{{- range $key, $value := .Values.wellknown.extraData }}
{{ $key }}.json: |-
{{- if $value | kindIs "string" -}}
{{ $value | nindent 4 }}
{{- else -}}
{{ $value | toJson | nindent 4 }}
{{- end -}}
{{- end -}}
{{- end -}}

View file

@ -64,12 +64,12 @@ spec:
- mountPath: /etc/lighttpd/lighttpd.conf
name: files
subPath: lighttpd.conf
- mountPath: {{ .Values.wellknown.htdocsPath }}/client.json
{{- $keys := concat (list "client" "server") (keys .Values.wellknown.extraData) }}
{{- range $key := $keys }}
- mountPath: {{ $.Values.wellknown.htdocsPath }}/{{ $key }}.json
name: files
subPath: client.json
- mountPath: {{ .Values.wellknown.htdocsPath }}/server.json
name: files
subPath: server.json
subPath: {{ $key }}.json
{{- end }}
- mountPath: /run
name: run
resources:

View file

@ -578,6 +578,18 @@ wellknown:
# m.homeserver:
# base_url: https://matrix.example.com
## Extra data objects to serve under .well-known/matrix/<data>
## Dictionaries will be JSON converted, plain strings will be served as they are
##
extraData: {}
## MSC1929 example;
# support:
# admins:
# - matrix_id: '@admin:example.com'
# email_address: 'admin@example.com'
# role: 'admin'
# support_page: 'https://example.com/support'
## A custom htdocs path, useful when running another image.
##
htdocsPath: /var/www/localhost/htdocs