mirror of
https://github.com/element-hq/ess-helm.git
synced 2026-11-21 09:31:28 -08:00
Add support for .well-known/matrix/support in Well Known Delegation
- Add new support configuration to well-known delegation - Modify schema to accommodate support configuration - Update templates to include support file - Update tests to verify support configuration handling
This commit is contained in:
10 files changed
+43
-2
No files matched your search
@@ -10,8 +10,13 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
frontend well-known-in
|
||||
bind *:8010
|
||||
|
||||
# same as http log, with %Th (handshake time)
|
||||
log-format "%ci:%cp [%tr] %ft %b/%s %Th/%TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"
|
||||
|
||||
|
||||
acl well-known path /.well-known/matrix/server
|
||||
acl well-known path /.well-known/matrix/client
|
||||
acl well-known path /.well-known/matrix/support
|
||||
acl well-known path /.well-known/element/element.json
|
||||
|
||||
use_backend well-known-static if well-known
|
||||
@@ -31,6 +36,7 @@ backend well-known-static
|
||||
|
||||
http-request return status 200 content-type "application/json" file "/well-known/server" if { path /.well-known/matrix/server }
|
||||
http-request return status 200 content-type "application/json" file "/well-known/client" if { path /.well-known/matrix/client }
|
||||
http-request return status 200 content-type "application/json" file "/well-known/support" if { path /.well-known/matrix/support }
|
||||
http-request return status 200 content-type "application/json" file "/well-known/element.json" if { path /.well-known/element/element.json }
|
||||
|
||||
{{- end -}}
|
||||
@@ -18,10 +18,13 @@
|
||||
"client": {
|
||||
"type": "string"
|
||||
},
|
||||
"element": {
|
||||
"type": "string"
|
||||
},
|
||||
"server": {
|
||||
"type": "string"
|
||||
},
|
||||
"element": {
|
||||
"support": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,3 +16,4 @@ additional:
|
||||
client: "{}"
|
||||
server: "{}"
|
||||
element: "{}"
|
||||
support: "{}"
|
||||
@@ -66,3 +66,12 @@ k8s.element.io/target-instance: {{ $root.Release.Name }}-haproxy
|
||||
{{- tpl (toPrettyJson (merge $config $additional)) $root -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
|
||||
{{- define "element-io.well-known-delegation.support" }}
|
||||
{{- $root := .root -}}
|
||||
{{- with required "element-io.well-known-delegation.support missing context" .context -}}
|
||||
{{- $config := dict -}}
|
||||
{{- $additional := .additional.support | fromJson -}}
|
||||
{{- tpl (toPrettyJson (merge $config $additional)) $root -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
@@ -18,6 +18,8 @@ data:
|
||||
{{ (tpl (include "element-io.well-known-delegation.client" (dict "root" $ "context" .)) $) | nindent 4 }}
|
||||
server: |
|
||||
{{ (tpl (include "element-io.well-known-delegation.server" (dict "root" $ "context" .)) $) | nindent 4 }}
|
||||
support: |
|
||||
{{ (tpl (include "element-io.well-known-delegation.support" (dict "root" $ "context" .)) $) | nindent 4 }}
|
||||
element.json: |
|
||||
{{ (tpl (include "element-io.well-known-delegation.element" (dict "root" $ "context" .)) $) | nindent 4 }}
|
||||
{{- end -}}
|
||||
|
||||
@@ -3761,10 +3761,13 @@
|
||||
"client": {
|
||||
"type": "string"
|
||||
},
|
||||
"element": {
|
||||
"type": "string"
|
||||
},
|
||||
"server": {
|
||||
"type": "string"
|
||||
},
|
||||
"element": {
|
||||
"support": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1047,3 +1047,4 @@ wellKnownDelegation:
|
||||
client: "{}"
|
||||
server: "{}"
|
||||
element: "{}"
|
||||
support: "{}"
|
||||
@@ -0,0 +1 @@
|
||||
Add support for .well-known/matrix/support in Well Known Delegation.
|
||||
@@ -29,6 +29,11 @@ async def test_well_known_files_can_be_accessed(
|
||||
else:
|
||||
assert json_content == {}
|
||||
|
||||
json_content = await aiottp_get_json(
|
||||
f"https://{generated_data.server_name}/.well-known/matrix/support", ssl_context
|
||||
)
|
||||
assert json_content == {}
|
||||
|
||||
json_content = await aiottp_get_json(
|
||||
f"https://{generated_data.server_name}/.well-known/element/element.json", ssl_context
|
||||
)
|
||||
|
||||
@@ -13,9 +13,11 @@ async def test_only_additional_if_all_disabled_in_well_known(values, make_templa
|
||||
client_config = {"testclientkey": {"testsubket": "testvalue"}}
|
||||
server_config = {"testserverkey": {"testsubket": "testvalue"}}
|
||||
element_config = {"testelementkey": {"testsubket": "testvalue"}}
|
||||
support_config = {"testsupportkey": {"testsubket": "testvalue"}}
|
||||
values["wellKnownDelegation"].setdefault("additional", {})["client"] = json.dumps(client_config)
|
||||
values["wellKnownDelegation"].setdefault("additional", {})["server"] = json.dumps(server_config)
|
||||
values["wellKnownDelegation"].setdefault("additional", {})["element"] = json.dumps(element_config)
|
||||
values["wellKnownDelegation"].setdefault("additional", {})["support"] = json.dumps(support_config)
|
||||
for template in await make_templates(values):
|
||||
if template["kind"] == "ConfigMap" and template["metadata"]["name"] == "pytest-well-known-haproxy":
|
||||
client_from_json = json.loads(template["data"]["client"])
|
||||
@@ -27,6 +29,9 @@ async def test_only_additional_if_all_disabled_in_well_known(values, make_templa
|
||||
element_from_json = json.loads(template["data"]["element.json"])
|
||||
assert element_from_json == element_config
|
||||
|
||||
support_config_from_json = json.loads(template["data"]["support"])
|
||||
assert support_config == support_config_from_json
|
||||
|
||||
break
|
||||
else:
|
||||
raise AssertionError("Unable to find WellKnownDelegationConfigMap")
|
||||
@@ -38,9 +43,11 @@ async def test_synapse_injected_in_server_and_client_well_known(values, make_tem
|
||||
client_config = {"testclientkey": {"testsubket": "testvalue"}}
|
||||
server_config = {"testserverkey": {"testsubket": "testvalue"}}
|
||||
element_config = {"testelementkey": {"testsubket": "testvalue"}}
|
||||
support_config = {"testsupportkey": {"testsubket": "testvalue"}}
|
||||
values["wellKnownDelegation"].setdefault("additional", {})["client"] = json.dumps(client_config)
|
||||
values["wellKnownDelegation"].setdefault("additional", {})["server"] = json.dumps(server_config)
|
||||
values["wellKnownDelegation"].setdefault("additional", {})["element"] = json.dumps(element_config)
|
||||
values["wellKnownDelegation"].setdefault("additional", {})["support"] = json.dumps(support_config)
|
||||
|
||||
synapse_federation = {"m.server": "synapse.ess.localhost:443"}
|
||||
synapse_base_url = {"m.homeserver": {"base_url": "https://synapse.ess.localhost"}}
|
||||
@@ -55,6 +62,9 @@ async def test_synapse_injected_in_server_and_client_well_known(values, make_tem
|
||||
element_from_json = json.loads(template["data"]["element.json"])
|
||||
assert element_from_json == element_config
|
||||
|
||||
support_from_json = json.loads(template["data"]["support"])
|
||||
assert support_from_json == support_config
|
||||
|
||||
break
|
||||
else:
|
||||
raise AssertionError("Unable to find WellKnownDelegationConfigMap")
|
||||
Reference in new issue
Block a user