matrix-synapse: Redo well-known server

Now allows custom .well-known/matrix/{server,client} data to be provided
This commit is contained in:
Alexander Olofsson 2021-03-20 20:34:51 +01:00
parent 8ae1000472
commit 6cbb8bf9fd
No known key found for this signature in database
GPG key ID: D439C9470CB04C73
4 changed files with 32 additions and 10 deletions

View file

@ -109,17 +109,21 @@ spec:
{{- end }}
{{- if has . $wkHosts }}
{{- if $.Values.wellknown.enabled }}
- path: /.well-known/matrix/client
backend:
serviceName: {{ $fullName }}
servicePort: 8008
{{- if $.Values.wellknown.enabled }}
serviceName: {{ $wkName }}
servicePort: 80
- path: /.well-known/matrix/server
backend:
serviceName: {{ $wkName }}
servicePort: 80
{{- end }}
{{- else }}
- path: /.well-known/matrix/client
backend:
serviceName: {{ $fullName }}
servicePort: 8008
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View file

@ -23,12 +23,11 @@ data:
server.groupname = "lighttpd"
server.document-root = {{ .Values.wellknown.htdocsPath | quote }}
server.pid-file = "/run/lighttpd.pid"
server.errorlog = "/dev/stderr"
url.rewrite-once = (
"^/\.well-known/matrix/client" => "/client.json",
"^/\.well-known/matrix/server" => "/server.json"
)
status.status-url = "/server-status"
accesslog.filename = "/dev/stderr"
extforward.forwarder = ( "all" => "trust")
setenv.add-response-header = (
"access-control-allow-headers" => "Origin, X-Requested-With, Content-Type, Accept, Authorization",
@ -39,5 +38,15 @@ data:
"content-type" => "application/json"
)
server.json: |-
{{- if .Values.wellknown.server }}
{{ toJson .Values.wellknown.server | nindent 4 }}
{{- else }}
{{ dict "m.server" (printf "%s:%d" (.Values.wellknown.host | default (.Values.publicServerName | default .Values.serverName)) (.Values.wellknown.port | default 443)) | toJson | indent 4 }}
{{- end }}
{{- end }}
client.json: |-
{{- if .Values.wellknown.client }}
{{ toJson .Values.wellknown.client | nindent 4 }}
{{- else }}
{{ dict "m.homeserver" (dict "base_url" (printf "https://%s/" (.Values.publicServerName | default .Values.serverName))) | toJson | indent 4 }}
{{- end }}
{{- end -}}

View file

@ -64,6 +64,9 @@ spec:
- mountPath: /etc/lighttpd/lighttpd.conf
name: files
subPath: lighttpd.conf
- mountPath: {{ .Values.wellknown.htdocsPath }}/client.json
name: files
subPath: client.json
- mountPath: {{ .Values.wellknown.htdocsPath }}/server.json
name: files
subPath: server.json

View file

@ -456,8 +456,14 @@ wellknown:
## The host and port combo to serve on .well-known/matrix/server.
##
# host: matrix.example.com
# port: 443
server: {}
# m.server: matrix.example.com:443
## Data to serve on .well-known/matrix/client.
##
client: {}
# m.homeserver:
# base_url: https://matrix.example.com
## A custom htdocs path, useful when running another image.
##