Skip to content

Commit 9271e24

Browse files
committed
Support both ADDOK_SQLITE_DB_PATH and SQLITE_DB_PATH env vars
- ADDOK_SQLITE_DB_PATH is the recommended convention - SQLITE_DB_PATH is kept for backward compatibility - Priority: ADDOK_SQLITE_DB_PATH > SQLITE_DB_PATH > config.SQLITE_DB_PATH
1 parent 3ee2012 commit 9271e24

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

addok_sqlite_store/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ def __init__(self, *args, **kwargs):
1111
self.init()
1212

1313
def init(self):
14-
self.conn = sqlite3.connect(os.environ.get('SQLITE_DB_PATH') or config.SQLITE_DB_PATH)
14+
db_path = (os.environ.get('ADDOK_SQLITE_DB_PATH') or
15+
os.environ.get('SQLITE_DB_PATH') or
16+
config.SQLITE_DB_PATH)
17+
self.conn = sqlite3.connect(db_path)
1518
self.lock = Lock()
1619
with self.conn as conn:
1720
conn.execute('CREATE TABLE IF NOT EXISTS '

0 commit comments

Comments
 (0)