diff options
author | Daniel Wagner-Hall <dawagner@gmail.com> | 2016-02-05 01:58:23 +0000 |
---|---|---|
committer | review.rocks <nobody@review.rocks> | 2016-02-05 01:58:23 +0000 |
commit | 6a9f1209dfe5b3c43726aff24000129856bdc084 (patch) | |
tree | e0459fc07083e15dc4dd1871c446d762b87c1f4e /synapse/app | |
parent | Merge pull request #557 from matrix-org/dbkr/profile_dont_return_null (diff) | |
download | synapse-6a9f1209dfe5b3c43726aff24000129856bdc084.tar.xz |
Error if macaroon key is missing from config
Currently we store all access tokens in the DB, and fall back to that check if we can't validate the macaroon, so our fallback works here, but for guests, their macaroons don't get persisted, so we don't get to find them in the database. Each restart, we generate a new ephemeral key, so guests lose access after each server restart. I tried to fix up the config stuff to be less insane, but gave up, so instead I bolt on yet another piece of custom one-off insanity. Also, add some basic tests for config generation and loading.
Diffstat (limited to 'synapse/app')
-rwxr-xr-x | synapse/app/homeserver.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index 0a6a19033d..89238cb7e3 100755 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -24,6 +24,7 @@ import resource import subprocess import sys import time +from synapse.config._base import ConfigError from synapse.python_dependencies import ( check_requirements, DEPENDENCY_LINKS @@ -350,11 +351,20 @@ def setup(config_options): Returns: HomeServer """ - config = HomeServerConfig.load_config( - "Synapse Homeserver", - config_options, - generate_section="Homeserver" - ) + try: + config = HomeServerConfig.load_config( + "Synapse Homeserver", + config_options, + generate_section="Homeserver" + ) + except ConfigError as e: + sys.stderr.write("\n" + e.message + "\n") + sys.exit(1) + + if not config: + # If a config isn't returned, and an exception isn't raised, we're just + # generating config files and shouldn't try to continue. + sys.exit(0) config.setup_logging() |