File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717
1818@asynccontextmanager
1919async def lifespan (app : Starlette ):
20- await model .init_engine (config .DB_URI , echo = False )
20+ await model .init_engine (config .DB , echo = False )
2121 poll_worker = poller .Poller ()
2222 importer = recordings .RecordingImporter (
2323 basedir = pathlib .Path (config .RECORDING_PATH ),
Original file line number Diff line number Diff line change @@ -62,6 +62,12 @@ def utcnow():
6262
6363async def init_engine (db : str , echo = False ):
6464 global async_engine , AsyncSessionMaker , ScopedSession
65+
66+ if db .startswith ("sqlite://" ):
67+ db = db .replace ("sqlite://" , "sqlite+aiosqlite://" )
68+ elif db .startswith ("postgres://" ):
69+ db = db .replace ("postgres://" , "postgres+asyncpg://" )
70+
6571 async_engine = create_async_engine (db , echo = echo )
6672 AsyncSessionMaker = async_sessionmaker (async_engine , expire_on_commit = False )
6773
Original file line number Diff line number Diff line change @@ -137,9 +137,10 @@ def __getattr__(self, name: str):
137137
138138
139139class BBBLBConfig (BaseConfig ):
140- #: An sqlalchemy-style database URL. MUST be an async-capable engine
141- #: Supportet are sqlite+aiosqlite:// and postgresql+asyncpg:// schemes.
142- DB_URI : str
140+ #: An sqlalchemy compatible database connection string, starting with either
141+ #: `sqlite://` or `postgresql://`. For example `sqlite:////path/to/file.db`
142+ #: or `postgresql://user:pass@host/name`.
143+ DB : str
143144
144145 #: Primary domain for this service. This will be added as bbblb-origin
145146 #: metadata to meetings and is used by e.g. the recording upload script
Original file line number Diff line number Diff line change @@ -13,9 +13,10 @@ See `examples/bbblb.env.example` for a full list.
1313The options here are lossely ordered by topic.
1414
1515<!-- snip_start -->
16- ` DB_URI ` (type: ` str ` , ** REQUIRED** )
17- An sqlalchemy-style database URL. MUST be an async-capable engine
18- Supportet are sqlite+aiosqlite:// and postgresql+asyncpg:// schemes.
16+ ` DB ` (type: ` str ` , ** REQUIRED** )
17+ An sqlalchemy compatible database connection string, starting with either
18+ ` sqlite:// ` or ` postgresql:// ` . For example ` sqlite:////path/to/file.db `
19+ or ` postgresql://user:pass@host/name ` .
1920
2021` DOMAIN ` (type: ` str ` , ** REQUIRED** )
2122Primary domain for this service. This will be added as bbblb-origin
Original file line number Diff line number Diff line change 1- # An sqlalchemy-style database URL. MUST be an async-capable engine
2- # Supportet are sqlite+aiosqlite:// and postgresql+asyncpg:// schemes.
1+ # An sqlalchemy compatible database connection string, starting with either
2+ # `sqlite://` or `postgresql://`. For example `sqlite:////path/to/file.db`
3+ # or `postgresql://user:pass@host/name`.
34# (REQUIRED; type: str)
4- #BBBLB_DB_URI =
5+ #BBBLB_DB =
56
67# Primary domain for this service. This will be added as bbblb-origin
78# metadata to meetings and is used by e.g. the recording upload script
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ services:
99 target : app
1010 restart : unless-stopped
1111 environment :
12- - BBBLB_DB=postgresql+asyncpg ://bbblb:bbblb@postgres/bbblb
12+ - BBBLB_DB=postgresql://bbblb:bbblb@postgres/bbblb
1313 - BBBLB_RECORDING_PATH=/data/recordings
1414 volumes :
1515 - ./data/recordings:/data/recordings
You can’t perform that action at this time.
0 commit comments