diff options
author | Erik Johnston <erik@matrix.org> | 2015-04-01 15:09:51 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-04-01 15:09:51 +0100 |
commit | e24c32e6f3c0d7c75529d05762645fe613085bec (patch) | |
tree | e47473f0ea37db1777c42ddf1dbb6e583497bd04 /synapse/app/homeserver.py | |
parent | Make work in both Maria and SQLite. Fix tests (diff) | |
download | synapse-e24c32e6f3c0d7c75529d05762645fe613085bec.tar.xz |
Fix SQLite support
Diffstat (limited to 'synapse/app/homeserver.py')
-rwxr-xr-x | synapse/app/homeserver.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py index b185b2f569..1ab6effd5f 100755 --- a/synapse/app/homeserver.py +++ b/synapse/app/homeserver.py @@ -365,7 +365,9 @@ def setup(config_options): else: db_config = { "name": "sqlite3", - "database": config.database_path, + "args": { + "database": config.database_path, + }, } db_config = { @@ -381,10 +383,12 @@ def setup(config_options): "use_unicode": True, }) elif name == "sqlite3": + def open_fun(conn): + prepare_database(conn, database_engine) db_config.setdefault("args", {}).update({ "cp_min": 1, "cp_max": 1, - "cp_openfun": prepare_database, + "cp_openfun": open_fun, }) else: raise RuntimeError("Unsupported database type '%s'" % (name,)) @@ -413,7 +417,12 @@ def setup(config_options): logger.info("Preparing database: %s...", db_name) try: - db_conn = database_engine.module.connect(**db_config.get("args", {})) + db_conn = database_engine.module.connect( + **{ + k: v for k, v in db_config.get("args", {}).items() + if not k.startswith("cp_") + } + ) if name == "sqlite3": prepare_sqlite3_database(db_conn) |