1
Fork 0

settings: $STATE_DIRECTORY is not useful

Packages on "real servers" will set it in package params.
This commit is contained in:
Motiejus Jakštys 2024-01-15 10:24:49 +02:00
parent 2301cb2191
commit 95c67fc575
1 changed files with 2 additions and 5 deletions

View File

@ -1,5 +1,5 @@
from pathlib import Path from pathlib import Path
from os import environ, path from os import environ
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent BASE_DIR = Path(__file__).resolve().parent.parent
@ -11,10 +11,7 @@ _GEOIP_PATH = environ.get('GEOIP_PATH')
if db := environ.get('E11SYNC_DATABASE_PATH'): if db := environ.get('E11SYNC_DATABASE_PATH'):
_DATABASE_PATH = db _DATABASE_PATH = db
else: else:
if statedir := environ.get('STATE_DIRECTORY'): _DATABASE_PATH = BASE_DIR / 'db.sqlite3'
_DATABASE_PATH = path.join(statedir, 'db.sqlite3')
else:
_DATABASE_PATH = BASE_DIR / 'db.sqlite3'
if secret_path := environ.get("E11SYNC_SECRET_KEY_PATH"): if secret_path := environ.get("E11SYNC_SECRET_KEY_PATH"):
with open(secret_path) as f: with open(secret_path) as f: