fix(cli): fatal on config parse error and use env for postgres log#6326
Merged
Conversation
Replace log.Error with log.WithError().Fatal() on ParseWithPrefix failure to prevent execution continuing with a nil config. Add PostgresLogLevel and PostgresLogVerbose fields to the config struct so that pgoptions.Log() no longer uses hardcoded values. Wire the new env vars in docker-compose.yml and .env following the existing SHELLHUB_POSTGRES_* pattern.
|
Claude finished @geovannewashington's task in 4m 50s —— View job Code Review CompleteReviewed 3 files across code quality, security, testing, Go patterns, and architecture — no issues found. The code looks good as-is. Summary of what was verified:
If you push additional changes and want a new review, tag |
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.
What changed?
log.Errorreplaced withlog.WithError().Fatal()on config parsefailure to prevent execution continuing with a nil config.
POSTGRES_LOG_LEVELandPOSTGRES_LOG_VERBOSEto theconfigstruct, replacing the hardcoded values in
pgoptions.Log().SHELLHUB_POSTGRES_LOG_LEVELandSHELLHUB_POSTGRES_LOG_VERBOSEto
.envand wired them throughdocker-compose.yml.Why
Config parse errors were silently ignored, leading to a nil pointer
dereference on the next line. The postgres log options were also
hardcoded with no way to control them from the environment.
How to test
./bin/docker-compose up -dSHELLHUB_POSTGRES_LOG_VERBOSE=notaboolin.env.override./bin/cli user lsand confirm a fatal log is printed./bin/cli user createfollowed by./bin/cli user lsto confirm normal operation./bin/docker-compose exec cli env | grep POSTGRES