summary refs log tree commit diff
path: root/synapse/app/homeserver.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-04-29 11:42:28 +0100
committerErik Johnston <erik@matrix.org>2015-04-29 11:42:28 +0100
commit204132a998ec3be7069a9f2dada323bcdb217908 (patch)
treedaca5c26782846ba1ff66260f8fef4a246522b64 /synapse/app/homeserver.py
parentimprove postgres blurb a bit (diff)
downloadsynapse-204132a998ec3be7069a9f2dada323bcdb217908.tar.xz
Check that postgres database has correct charset set
Diffstat (limited to 'synapse/app/homeserver.py')
-rwxr-xr-xsynapse/app/homeserver.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py
index 694a0125ad..cbd295c0a5 100755
--- a/synapse/app/homeserver.py
+++ b/synapse/app/homeserver.py
@@ -17,7 +17,7 @@
 import sys
 sys.dont_write_bytecode = True
 
-from synapse.storage.engines import create_engine
+from synapse.storage.engines import create_engine, IncorrectDatabaseSetup
 from synapse.storage import (
     are_all_users_on_domain, UpgradeDatabaseException,
 )
@@ -255,6 +255,15 @@ class SynapseHomeServer(HomeServer):
             )
             sys.exit(1)
 
+        try:
+            database_engine.check_database(db_conn.cursor())
+        except IncorrectDatabaseSetup as e:
+            sys.stderr.write("*" * len(e.message) + '\n')
+            sys.stderr.write(e.message)
+            sys.stderr.write('\n')
+            sys.stderr.write("*" * len(e.message) + '\n')
+            sys.exit(2)
+
 
 def get_version_string():
     try: