From 8e85ba99e59f4cac50177f1d4c79acaf27d62d27 Mon Sep 17 00:00:00 2001 From: Sijmen Schoon Date: Thu, 19 Oct 2017 00:39:31 +0200 Subject: [PATCH] Make Matrix AS port configurable. Fixes #35 --- config.json.example | 5 +++-- telematrix/__init__.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/config.json.example b/config.json.example index 263027d..67378e0 100644 --- a/config.json.example +++ b/config.json.example @@ -13,6 +13,7 @@ }, "user_id_format": "@telegram_{}:DOMAIN.TLD", - "db_url": "sqlite:///database.db" -} + "db_url": "sqlite:///database.db", + "as_port": 5000 +} diff --git a/telematrix/__init__.py b/telematrix/__init__.py index bea6220..1e2113e 100644 --- a/telematrix/__init__.py +++ b/telematrix/__init__.py @@ -44,6 +44,7 @@ try: USER_ID_FORMAT = CONFIG['user_id_format'] DATABASE_URL = CONFIG['db_url'] + AS_PORT = CONFIG['as_port'] if 'as_port' in CONFIG else 5000 except (OSError, IOError) as exception: print('Error opening config file:') print(exception) @@ -709,7 +710,7 @@ def main(): app.router.add_route('GET', '/rooms/{room_alias}', matrix_room) app.router.add_route('PUT', '/transactions/{transaction}', matrix_transaction) - web.run_app(app, port=5000) + web.run_app(app, port=AS_PORT) if __name__ == "__main__":