New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate the DB config from yaml template to viper #1321
Migrate the DB config from yaml template to viper #1321
Conversation
040d82a
to
05cf1d0
Compare
Could you add more context to your zap errors? I think a connection can be output as a url string that can be added as |
Or maybe just the username, host, port, and db separately, so we don't add password to logs by accident? |
Yeah, it should be hard to add more context there. Also, I noticed that all the other binaries in |
IMHO, it's fine to keep the other binaries as is for this PR, since this is a non-destructive change (if we keep the database.yml file there). We'd want to add something to the backlog to update all the binaries. |
This appears to have gone up to I have one more change before I'd be ready to merge this. |
Could you make the |
I think I'll be merging this Monday just to make sure we have everyone around if there's an issue. |
cmd/webserver/main.go
Outdated
// Set up the connection | ||
connection, err := pop.NewConnection(&dbConnectionDetails) | ||
if err != nil { | ||
logger.Error("Failed create DB conection", zap.Error(err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix typo! Thanks @kilbergr !
Description
Pop currently uses a YAML config file that is a go template to load environment variables. This indirect approach should be changed to manually creating a connection on startup while using viper to capture the configuration values.
Reviewer Notes
I'm a bit worried that I'm overly verbose with error messages and would love input about it.
Setup
Start the server and the app. You should be able to get any db query to work.
Code Review Verification Steps
References