fix(hindsight-embed): respect HINDSIGHT_API_DATABASE_URL if already set (#262)
The daemon_client unconditionally overwrites HINDSIGHT_API_DATABASE_URL with pg0://hindsight-embed, preventing users from using an external PostgreSQL instance. This is a problem for VPS deployments running as root, where pg0's embedded PostgreSQL fails with 'initdb: cannot be run as root'. This change checks if the env var is already set before defaulting to pg0, allowing users to point to an external PostgreSQL while preserving the default embedded behavior. Fixes #261
This commit is contained in:
parent
039944cae2
commit
f0cb1925ec
1 changed files with 4 additions and 1 deletions
|
|
@ -76,7 +76,10 @@ def _start_daemon(config: dict) -> bool:
|
|||
env["HINDSIGHT_API_LLM_MODEL"] = config["llm_model"]
|
||||
|
||||
# Use single shared pg0 database for all banks (banks are isolated within the database)
|
||||
env["HINDSIGHT_API_DATABASE_URL"] = "pg0://hindsight-embed"
|
||||
# Allow override via HINDSIGHT_API_DATABASE_URL for external PostgreSQL
|
||||
# (e.g. when running as root where embedded pg0 cannot use initdb)
|
||||
if "HINDSIGHT_API_DATABASE_URL" not in env:
|
||||
env["HINDSIGHT_API_DATABASE_URL"] = "pg0://hindsight-embed"
|
||||
env["HINDSIGHT_API_LOG_LEVEL"] = "info"
|
||||
|
||||
# Get idle timeout from environment or use default
|
||||
|
|
|
|||
Loading…
Reference in a new issue