mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 13:18:18 +00:00
Allow setting embedded postgres db directory with PGSERVER_DATA_DIR env var (#1202)
It seems to me that it would be useful to be able to be explicit about where the embedded database should live - as well as where it _does_ live (via the info log), when not specifying.
This commit is contained in:
@@ -139,10 +139,10 @@ if USE_EMBEDDED_DB:
|
||||
import pgserver
|
||||
|
||||
# Set up data directory
|
||||
PGSERVER_DATA_DIR = os.path.join(BASE_DIR, "pgserver_data")
|
||||
PGSERVER_DATA_DIR = os.getenv("PGSERVER_DATA_DIR") or os.path.join(BASE_DIR, "pgserver_data")
|
||||
os.makedirs(PGSERVER_DATA_DIR, exist_ok=True)
|
||||
|
||||
logger.debug(f"Initializing embedded Postgres DB with data directory: {PGSERVER_DATA_DIR}")
|
||||
logger.info(f"Initializing embedded Postgres DB with data directory: {PGSERVER_DATA_DIR}")
|
||||
|
||||
# Start server
|
||||
PGSERVER_INSTANCE = pgserver.get_server(PGSERVER_DATA_DIR)
|
||||
|
||||
Reference in New Issue
Block a user