-
-
Notifications
You must be signed in to change notification settings - Fork 944
Closed
Description
Method setupSSLClientCertificates uses uses getpwuid_r (via user.Current) to find the user's home directory.
// Automatically load certificates from ~/.postgresql.
user, err := user.Current()
if err != nil {
// user.Current() might fail when cross-compiling. We have to
// ignore the error and continue without client certificates, since
// we wouldn't know where to load them from.
return
}It would be better to use the environment variable HOME (or, on windows, a combination of HOMEDRIVE and HOMEPATH). That way the user can control where it looks.
Avoiding os/user would also prevent having to call into cgo, which would make cross compiling a bit easier and behave more consistently. For example, the comment above about how the lookup "might fail" would no longer be necessary.
If this sounds ok, I'll send a patch.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels