mirror of
https://github.com/th3r00t/pyShelf.git
synced 2026-04-28 01:59:35 -04:00
Refactored configuration system
This commit is contained in:
7
src/backend/lib/storage.py
vendored
7
src/backend/lib/storage.py
vendored
@@ -49,12 +49,7 @@ class Storage:
|
||||
str : sqlalchemy Connection String
|
||||
"""
|
||||
if self.config.db_engine == "sqlite":
|
||||
if os.path.exists(f"{self.config.root}/pyshelf.db"):
|
||||
return f"sqlite:////{self.config.root}/pyshelf.db"
|
||||
else:
|
||||
sqlite_file = open(f'{self.config.root}/pyshelf.db', 'w')
|
||||
sqlite_file.close()
|
||||
return f"sqlite://{self.config.root}/pyshelf.db"
|
||||
return f"sqlite:////{self.config.root}/pyshelf.db"
|
||||
elif self.config.db_engine == "psql":
|
||||
return f"postgresql://{self.user}:{self.password}\
|
||||
@{self.db_host}:{self.db_port}/{self.sql}"
|
||||
|
||||
Reference in New Issue
Block a user