Make Matrix AS port configurable. Fixes #35

This commit is contained in:
Sijmen Schoon 2017-10-19 00:39:31 +02:00
parent 24e8ae9670
commit 8e85ba99e5
2 changed files with 5 additions and 3 deletions

View File

@ -13,6 +13,7 @@
}, },
"user_id_format": "@telegram_{}:DOMAIN.TLD", "user_id_format": "@telegram_{}:DOMAIN.TLD",
"db_url": "sqlite:///database.db" "db_url": "sqlite:///database.db",
}
"as_port": 5000
}

View File

@ -44,6 +44,7 @@ try:
USER_ID_FORMAT = CONFIG['user_id_format'] USER_ID_FORMAT = CONFIG['user_id_format']
DATABASE_URL = CONFIG['db_url'] DATABASE_URL = CONFIG['db_url']
AS_PORT = CONFIG['as_port'] if 'as_port' in CONFIG else 5000
except (OSError, IOError) as exception: except (OSError, IOError) as exception:
print('Error opening config file:') print('Error opening config file:')
print(exception) print(exception)
@ -709,7 +710,7 @@ def main():
app.router.add_route('GET', '/rooms/{room_alias}', matrix_room) app.router.add_route('GET', '/rooms/{room_alias}', matrix_room)
app.router.add_route('PUT', '/transactions/{transaction}', app.router.add_route('PUT', '/transactions/{transaction}',
matrix_transaction) matrix_transaction)
web.run_app(app, port=5000) web.run_app(app, port=AS_PORT)
if __name__ == "__main__": if __name__ == "__main__":