Skip to content

Fix exec_sql to use configured credentials instead of hardcoded defaults#2431

Closed
scbrown wants to merge 1 commit intodolthub:mainfrom
scbrown:fix-docker-entrypoint-credentials
Closed

Fix exec_sql to use configured credentials instead of hardcoded defaults#2431
scbrown wants to merge 1 commit intodolthub:mainfrom
scbrown:fix-docker-entrypoint-credentials

Conversation

@scbrown
Copy link
Copy Markdown

@scbrown scbrown commented Mar 6, 2026

Summary

  • exec_sql in docker-entrypoint.sh hardcoded PGPASSWORD=password and -U postgres, causing init scripts in /docker-entrypoint-initdb.d/ to silently fail when DOLTGRES_USER/DOLTGRES_PASSWORD are set to custom values
  • Now uses the existing get_env_var helper to read configured credentials, falling back to postgres/password only when neither env var is set

Test plan

  • docker run with default credentials — init scripts should still work
  • docker run with DOLTGRES_USER=myuser DOLTGRES_PASSWORD=mypass — init scripts should connect as myuser
  • docker run with POSTGRES_USER=myuser POSTGRES_PASSWORD=mypass — same behavior via POSTGRES_* compat

Fixes #2300

The exec_sql function hardcoded PGPASSWORD=password and -U postgres
when connecting via psql. This caused init scripts in
/docker-entrypoint-initdb.d/ to silently fail when DOLTGRES_USER or
DOLTGRES_PASSWORD were set to custom values, because the postgres
user no longer exists.

Use the existing get_env_var helper to read DOLTGRES_USER/PASSWORD
(or POSTGRES_USER/PASSWORD), falling back to postgres/password only
when neither is set.

Fixes dolthub#2300
@scbrown
Copy link
Copy Markdown
Author

scbrown commented Mar 6, 2026

Closing per maintainer request.

@scbrown scbrown closed this Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docker entrypoint exec_sql hardcodes postgres/password credentials, ignoring DOLTGRES_USER/DOLTGRES_PASSWORD

2 participants