Fix exec_sql to use configured credentials instead of hardcoded defaults#2431
Closed
scbrown wants to merge 1 commit intodolthub:mainfrom
Closed
Fix exec_sql to use configured credentials instead of hardcoded defaults#2431scbrown wants to merge 1 commit intodolthub:mainfrom
scbrown wants to merge 1 commit intodolthub:mainfrom
Conversation
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
Author
|
Closing per maintainer request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
exec_sqlindocker-entrypoint.shhardcodedPGPASSWORD=passwordand-U postgres, causing init scripts in/docker-entrypoint-initdb.d/to silently fail whenDOLTGRES_USER/DOLTGRES_PASSWORDare set to custom valuesget_env_varhelper to read configured credentials, falling back topostgres/passwordonly when neither env var is setTest plan
docker runwith default credentials — init scripts should still workdocker runwithDOLTGRES_USER=myuser DOLTGRES_PASSWORD=mypass— init scripts should connect asmyuserdocker runwithPOSTGRES_USER=myuser POSTGRES_PASSWORD=mypass— same behavior via POSTGRES_* compatFixes #2300