Skip to content

Harmonize delphi env variable names with the rest of the codebase #2442

@jucor

Description

@jucor

Problem

The rest of the polis codebase uses POSTGRES_* env variable names (POSTGRES_HOST, POSTGRES_DB, POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_PORT), defined in example.env and consumed by bin/ scripts, docker-compose.yml, CI workflows, and CDK.

Delphi's Python code uses a different set of names for the same settings:

Setting Repo standard Delphi
Host POSTGRES_HOST DATABASE_HOST
Port POSTGRES_PORT DATABASE_PORT
Database POSTGRES_DB DATABASE_NAME
User POSTGRES_USER DATABASE_USER
Password POSTGRES_PASSWORD DATABASE_PASSWORD
Connection string DATABASE_URL DATABASE_URL (same)

This causes confusion and bugs:

  • docker-compose.yml bridges the gap with DATABASE_HOST=${POSTGRES_HOST}, which is fragile
  • Test files that use the wrong set of names get wrong defaults and fail silently
  • Two naming conventions for the same thing is just dirty

Files to update

Delphi files using DATABASE_HOST / DATABASE_* (non-standard names):

  • delphi/polismath/database/postgres.pyPostgresConfig class and from_env()
  • delphi/umap_narrative/polismath_commentgraph/utils/storage.py

Proposed fix

Rename DATABASE_HOSTPOSTGRES_HOST, DATABASE_NAMEPOSTGRES_DB, etc. in the delphi Python code to match the repo-wide convention. DATABASE_URL stays as-is (it's already consistent). The docker-compose.yml mapping (DATABASE_HOST=${POSTGRES_HOST}) can then be removed.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions