mirror of
https://github.com/sosedoff/pgweb.git
synced 2024-12-15 11:52:12 +03:00
Make getCurrentUser method private
This commit is contained in:
parent
0a7de05892
commit
fa0efb1597
@ -67,7 +67,7 @@ func ParseOptions(args []string) (Options, error) {
|
|||||||
// Handle edge case where pgweb is started with a default host `localhost` and no user.
|
// Handle edge case where pgweb is started with a default host `localhost` and no user.
|
||||||
// When user is not set the `lib/pq` connection will fail and cause pgweb's termination.
|
// When user is not set the `lib/pq` connection will fail and cause pgweb's termination.
|
||||||
if (opts.Host == "localhost" || opts.Host == "127.0.0.1") && opts.User == "" {
|
if (opts.Host == "localhost" || opts.Host == "127.0.0.1") && opts.User == "" {
|
||||||
if username := GetCurrentUser(); username != "" {
|
if username := getCurrentUser(); username != "" {
|
||||||
opts.User = username
|
opts.User = username
|
||||||
} else {
|
} else {
|
||||||
opts.Host = ""
|
opts.Host = ""
|
||||||
@ -131,8 +131,8 @@ func SetDefaultOptions() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetCurrentUser returns a current user name
|
// getCurrentUser returns a current user name
|
||||||
func GetCurrentUser() string {
|
func getCurrentUser() string {
|
||||||
u, _ := user.Current()
|
u, _ := user.Current()
|
||||||
if u != nil {
|
if u != nil {
|
||||||
return u.Username
|
return u.Username
|
||||||
|
Loading…
Reference in New Issue
Block a user