From 9fd506e09884307269b78c89888c629db2b7cfd4 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 26 Dec 2021 13:12:29 +0200 Subject: [PATCH] Change example database config to postgres --- docker-run.sh | 3 --- mautrix_telegram/config.py | 4 ++++ mautrix_telegram/example-config.yaml | 2 +- optional-requirements.txt | 3 +++ requirements.txt | 1 - 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docker-run.sh b/docker-run.sh index 33ef2de4..ae49488b 100755 --- a/docker-run.sh +++ b/docker-run.sh @@ -7,9 +7,6 @@ function fixperms { cd /opt/mautrix-telegram -# Replace database path in config. -sed -i "s#sqlite:///mautrix-telegram.db#sqlite:////data/mautrix-telegram.db#" /data/config.yaml - if [ ! -f /data/config.yaml ]; then cp example-config.yaml /data/config.yaml echo "Didn't find a config file." diff --git a/mautrix_telegram/config.py b/mautrix_telegram/config.py index f7fa6b84..08f00f72 100644 --- a/mautrix_telegram/config.py +++ b/mautrix_telegram/config.py @@ -45,6 +45,10 @@ class Config(BaseBridgeConfig): def forbidden_defaults(self) -> List[ForbiddenDefault]: return [ *super().forbidden_defaults, + ForbiddenDefault( + "appservice.database", + "postgres://username:password@hostname/dbname", + ), ForbiddenDefault( "appservice.public.external", "https://example.com/public", diff --git a/mautrix_telegram/example-config.yaml b/mautrix_telegram/example-config.yaml index b7ab3690..cfc59e2f 100644 --- a/mautrix_telegram/example-config.yaml +++ b/mautrix_telegram/example-config.yaml @@ -37,7 +37,7 @@ appservice: # Format examples: # SQLite: sqlite:///filename.db # Postgres: postgres://username:password@hostname/dbname - database: sqlite:///mautrix-telegram.db + database: postgres://username:password@hostname/dbname # Additional arguments for asyncpg.create_pool() or sqlite3.connect() # https://magicstack.github.io/asyncpg/current/api/index.html#asyncpg.pool.create_pool # https://docs.python.org/3/library/sqlite3.html#sqlite3.connect diff --git a/optional-requirements.txt b/optional-requirements.txt index 44b4da2a..c9ac7463 100644 --- a/optional-requirements.txt +++ b/optional-requirements.txt @@ -24,3 +24,6 @@ prometheus_client>=0.6,<0.13 python-olm>=3,<4 pycryptodome>=3,<4 unpaddedbase64>=1,<3 + +#/sqlite +aiosqlite>=0.16,<0.18 diff --git a/requirements.txt b/requirements.txt index db9271b3..e65024ed 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,6 +8,5 @@ mautrix>=0.14.0rc4,<0.15 # Fork to make session storage async tulir-telethon==1.25.0a1 asyncpg>=0.20,<0.26 -aiosqlite>=0.17,<0.18 mako>=1,<2 setuptools