mirror of
https://github.com/janeczku/calibre-web
synced 2024-12-25 01:20:32 +00:00
Read dbpath from $CALIBRE_DBPATH if present
This is an exploration in potentially enabling multiple libraries to run using the same engine. Since app config is all in the db, we should get no port conflicts and be able to run multiple instances of this app with no issues. Using os.getenv instead of os.environ.get allows us to provide CALIBRE_DBPATH inline with the invocation of the file (`CALIBRE_DBPATH=/foo/bar/` python cps.py)
This commit is contained in:
parent
cbc807f3ff
commit
2c173f9848
@ -13,7 +13,7 @@ from flask_babel import gettext as _
|
||||
import json
|
||||
#from builtins import str
|
||||
|
||||
dbpath = os.path.join(os.path.normpath(os.path.dirname(os.path.realpath(__file__)) + os.sep + ".." + os.sep), "app.db")
|
||||
dbpath = os.path.join(os.path.normpath(os.getenv("CALIBRE_DBPATH", os.path.dirname(os.path.realpath(__file__)) + os.sep + ".." + os.sep)), "app.db")
|
||||
engine = create_engine('sqlite:///{0}'.format(dbpath), echo=False)
|
||||
Base = declarative_base()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user