Skip to content

Fix: propagate sslmode env var#5374

Open
ak7991 wants to merge 4 commits into
mem0ai:mainfrom
ak7991:fix/propagate-sslmode-env-var
Open

Fix: propagate sslmode env var#5374
ak7991 wants to merge 4 commits into
mem0ai:mainfrom
ak7991:fix/propagate-sslmode-env-var

Conversation

@ak7991
Copy link
Copy Markdown

@ak7991 ak7991 commented Jun 4, 2026

Linked Issue

Relates to #5303

Description

Simply propagate the POSTGRES_SSLMODE environment variable to the self-hosted server's database configuration.

Specifically, this PR:

  1. Updates server-side database connection URL builder (server/db.py) to append the sslmode queryparam when POSTGRES_SSLMODE is provided.
  2. Propagates POSTGRES_SSLMODE into the default pgvector store configuration in server/main.py.

This is a focused follow-up to PR #5308 to address the server-side SSL.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactor (no functional changes)
  • Documentation update

Test Coverage

  • I added/updated unit tests
  • I added/updated integration tests
  • I tested manually (describe below)
  • No tests needed (explain why)

Checked that the generated database connection string correctly appends ?sslmode=require (or other specified modes) when the POSTGRES_SSLMODE environment variable is set, allowing connections to PostgreSQL instances requiring SSL (e.g., hosted/managed Postgres services).

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have added tests that prove my fix/feature works
  • New and existing tests pass locally
  • I have updated documentation if needed

@ak7991
Copy link
Copy Markdown
Author

ak7991 commented Jun 4, 2026

Added the propagation of env var as requested.

Hey @kartik-mem0, would recommend to add support for directly providing db connection strings. sslmode support we added, but there are many other queryparams.
Example: postgresql://user:pass@primary-db:5432,replica-db:5432/mem0_db?target_session_attrs=read-write&connect_timeout=5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant