Skip to content

Commit

Permalink
Support loading application service files from /data/appservices/
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiyou committed Feb 5, 2018
1 parent 107a5c9 commit 1ffd9cb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
7 changes: 6 additions & 1 deletion contrib/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 8 additions & 1 deletion contrib/docker/conf/homeserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions contrib/docker/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
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
Expand All @@ -26,6 +27,9 @@
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"])
Expand Down

0 comments on commit 1ffd9cb

Please sign in to comment.