diff options
| author | hilimd <68371223+hilimd@users.noreply.github.com> | 2020-10-26 22:01:50 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-26 22:01:50 +0800 |
| commit | 843865f2ca534bb6286b7a3d79c436384d875608 (patch) | |
| tree | 653943fe04caf3fe607416715fb341460a624ab7 /weed/filer/postgres/postgres_store.go | |
| parent | cf7a1c722fa82fa78c546f68e4814fff7dc6d1e2 (diff) | |
| parent | 44921220b01d21c64755cbc7560ff8932f71984d (diff) | |
| download | seaweedfs-843865f2ca534bb6286b7a3d79c436384d875608.tar.xz seaweedfs-843865f2ca534bb6286b7a3d79c436384d875608.zip | |
Merge pull request #33 from chrislusf/master
sync
Diffstat (limited to 'weed/filer/postgres/postgres_store.go')
| -rw-r--r-- | weed/filer/postgres/postgres_store.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/weed/filer/postgres/postgres_store.go b/weed/filer/postgres/postgres_store.go index c41700d17..2325568fe 100644 --- a/weed/filer/postgres/postgres_store.go +++ b/weed/filer/postgres/postgres_store.go @@ -11,7 +11,7 @@ import ( ) const ( - CONNECTION_URL_PATTERN = "host=%s port=%d user=%s sslmode=%s connect_timeout=30" + CONNECTION_URL_PATTERN = "host=%s port=%d sslmode=%s connect_timeout=30" ) func init() { @@ -49,7 +49,10 @@ func (store *PostgresStore) initialize(user, password, hostname string, port int store.SqlListExclusive = "SELECT NAME, meta FROM filemeta WHERE dirhash=$1 AND name>$2 AND directory=$3 AND name like $4 ORDER BY NAME ASC LIMIT $5" store.SqlListInclusive = "SELECT NAME, meta FROM filemeta WHERE dirhash=$1 AND name>=$2 AND directory=$3 AND name like $4 ORDER BY NAME ASC LIMIT $5" - sqlUrl := fmt.Sprintf(CONNECTION_URL_PATTERN, hostname, port, user, sslmode) + sqlUrl := fmt.Sprintf(CONNECTION_URL_PATTERN, hostname, port, sslmode) + if user != "" { + sqlUrl += " user=" + user + } if password != "" { sqlUrl += " password=" + password } |
