mirror of
https://github.com/maubot/maubot.git
synced 2024-10-01 01:06:10 -04:00
Merge pull request #127 from deepbluev7/patch-1
Fix crypto db not working with scheme postgresql
This commit is contained in:
commit
ebd4ae9f55
@ -409,7 +409,7 @@ def init(config: 'Config', loop: asyncio.AbstractEventLoop) -> Iterable[Client]:
|
|||||||
parsed_url = URL(db_url)
|
parsed_url = URL(db_url)
|
||||||
if parsed_url.scheme == "sqlite":
|
if parsed_url.scheme == "sqlite":
|
||||||
Client.crypto_pickle_dir = config["crypto_database.pickle_dir"]
|
Client.crypto_pickle_dir = config["crypto_database.pickle_dir"]
|
||||||
elif parsed_url.scheme == "postgres":
|
elif parsed_url.scheme == "postgres" or parsed_url.scheme == "postgresql":
|
||||||
if not PgCryptoStore:
|
if not PgCryptoStore:
|
||||||
log.warning("Default database is postgres, but asyncpg is not installed. "
|
log.warning("Default database is postgres, but asyncpg is not installed. "
|
||||||
"Encryption will not work.")
|
"Encryption will not work.")
|
||||||
@ -418,7 +418,7 @@ def init(config: 'Config', loop: asyncio.AbstractEventLoop) -> Iterable[Client]:
|
|||||||
upgrade_table=PgCryptoStore.upgrade_table)
|
upgrade_table=PgCryptoStore.upgrade_table)
|
||||||
elif db_type == "pickle":
|
elif db_type == "pickle":
|
||||||
Client.crypto_pickle_dir = config["crypto_database.pickle_dir"]
|
Client.crypto_pickle_dir = config["crypto_database.pickle_dir"]
|
||||||
elif db_type == "postgres" and PgCryptoStore:
|
elif (db_type == "postgres" or db_type == "postgresql") and PgCryptoStore:
|
||||||
Client.crypto_db = AsyncDatabase(url=config["crypto_database.postgres_uri"],
|
Client.crypto_db = AsyncDatabase(url=config["crypto_database.postgres_uri"],
|
||||||
upgrade_table=PgCryptoStore.upgrade_table)
|
upgrade_table=PgCryptoStore.upgrade_table)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user