diff options
author | Erik Johnston <erik@matrix.org> | 2015-04-28 13:39:42 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-04-28 13:39:42 +0100 |
commit | 327ca883ec51780ea2a914d3c89ca0499f4656ac (patch) | |
tree | dc3f2c06cdbbfce8b1d1bb6a4db31a8852f5b43a /synapse/app | |
parent | Quickly fix dodgy est. time remaining (diff) | |
parent | Merge pull request #126 from matrix-org/csauth (diff) | |
download | synapse-327ca883ec51780ea2a914d3c89ca0499f4656ac.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into postgres
Diffstat (limited to 'synapse/app')
-rwxr-xr-x | synapse/app/homeserver.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index 110566e33f..43ce12af72 100755 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -17,8 +17,11 @@ import sys sys.dont_write_bytecode = True -from synapse.storage import UpgradeDatabaseException from synapse.storage.engines import create_engine +from synapse.storage import ( + prepare_database, prepare_sqlite3_database, are_all_users_on_domain, + UpgradeDatabaseException, +) from synapse.server import HomeServer @@ -238,6 +241,21 @@ class SynapseHomeServer(HomeServer): ) logger.info("Metrics now running on 127.0.0.1 port %d", config.metrics_port) + def run_startup_checks(self, db_conn, database_engine): + all_users_native = are_all_users_on_domain( + db_conn.cursor(), database_engine, self.hostname + ) + if not all_users_native: + sys.stderr.write( + "\n" + "******************************************************\n" + "Found users in database not native to %s!\n" + "You cannot changed a synapse server_name after it's been configured\n" + "******************************************************\n" + "\n" % (self.hostname,) + ) + sys.exit(1) + def get_version_string(): try: @@ -382,6 +400,7 @@ def setup(config_options): ) database_engine.prepare_database(db_conn) + hs.run_startup_checks(db_conn, database_engine) db_conn.commit() except UpgradeDatabaseException: |