mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-21 14:07:59 +00:00
set sqlite file path relative to config path if possible
This commit is contained in:
parent
9cc79aa79a
commit
57d7d25743
|
@ -57,6 +57,9 @@ class Config:
|
|||
|
||||
@property
|
||||
def sqlite_path(self) -> Path:
|
||||
if not os.path.isabs(self.sq_path):
|
||||
return self.path.parent.joinpath(self.sq_path).resolve()
|
||||
|
||||
return Path(self.sq_path).expanduser().resolve()
|
||||
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ if typing.TYPE_CHECKING:
|
|||
|
||||
def get_database(config: Config, migrate: Optional[bool] = True) -> tinysql.Database:
|
||||
if config.db_type == "sqlite":
|
||||
db = tinysql.Database.sqlite(config.sq_path, connection_class = Connection)
|
||||
db = tinysql.Database.sqlite(config.sqlite_path, connection_class = Connection)
|
||||
|
||||
elif config.db_type == "postgres":
|
||||
db = tinysql.Database.postgres(
|
||||
|
|
Loading…
Reference in a new issue