0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-06-01 02:08:56 +02:00

Support loading application service files from /data/appservices/

This commit is contained in:
kaiyou 2018-02-05 23:13:27 +01:00
parent 107a5c9441
commit 1ffd9cb936
3 changed files with 18 additions and 2 deletions

View file

@ -59,7 +59,12 @@ The image expects a single volume, located at ``/data``, that will hold:
* temporary files during uploads;
* uploaded media and thumbnails;
* the SQLite database if you do not configure postgres.
* the SQLite database if you do not configure postgres;
* the appservices configuration.
In order to setup an application service, simply create an ``appservices``
directory in the data volume and write the application service Yaml
configuration file there. Multiple application services are supported.
## Environment

View file

@ -128,7 +128,7 @@ recaptcha_siteverify_api: "https://www.google.com/recaptcha/api/siteverify"
{% if SYNAPSE_TURN_URIS %}
turn_uris:
{% for uri in SYNAPSE_TURN_URIS.split(',') %} - {{ uri }}
{% for uri in SYNAPSE_TURN_URIS.split(',') %} - "{{ uri }}"
{% endfor %}
turn_shared_secret: "{{ SYNAPSE_TURN_SECRET }}"
turn_user_lifetime: "1h"
@ -167,7 +167,14 @@ room_invite_state_types:
- "m.room.avatar"
- "m.room.name"
{% if SYNAPSE_APPSERVICES %}
app_service_config_files:
{% for appservice in SYNAPSE_APPSERVICES %} - "{{ appservice }}"
{% endfor %}
{% else %}
app_service_config_files: []
{% endif %}
macaroon_secret_key: "{{ SYNAPSE_MACAROON_SECRET_KEY }}"
expire_access_token: False

View file

@ -4,6 +4,7 @@ import jinja2
import os
import sys
import subprocess
import glob
convert = lambda src, dst, environ: open(dst, "w").write(jinja2.Template(open(src).read()).render(**environ))
mode = sys.argv[1] if len(sys.argv) > 1 else None
@ -26,6 +27,9 @@ for secret in ("SYNAPSE_REGISTRATION_SHARED_SECRET", "SYNAPSE_MACAROON_SECRET_KE
print("Generating a random secret for {}".format(secret))
environ[secret] = os.urandom(32).encode("hex")
# Load appservices configurations
environ["SYNAPSE_APPSERVICES"] = glob.glob("/data/appservices/*.yaml")
# In generate mode, generate a configuration, missing keys, then exit
if mode == "generate":
os.execv("/usr/local/bin/python", args + ["--generate-config"])