diff options
| author | Mesar Hameed <mesar.hameed+github@gmail.com> | 2023-05-16 01:45:14 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-15 17:45:14 -0700 |
| commit | 65484e80ef2bb1517b45a19232231cf81852eca6 (patch) | |
| tree | 79250a563a3d2f5a88443d074f4b6eedb42b9cea | |
| parent | 64b2fbe0f1a50f9a2371889b476b047e3b7fca65 (diff) | |
| download | seaweedfs-65484e80ef2bb1517b45a19232231cf81852eca6.tar.xz seaweedfs-65484e80ef2bb1517b45a19232231cf81852eca6.zip | |
Feat: support username/password authentication for etcd filer store s… (#4477)
Feat: support username/password authentication for etcd filer store seaweedfs/seaweedfs#4262
Co-authored-by: Mesar Hameed <mesar.hameed@gmail.com>
| -rw-r--r-- | weed/command/scaffold/filer.toml | 2 | ||||
| -rw-r--r-- | weed/filer/etcd/etcd_store.go | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/weed/command/scaffold/filer.toml b/weed/command/scaffold/filer.toml index 85c11f783..b4c20d2bf 100644 --- a/weed/command/scaffold/filer.toml +++ b/weed/command/scaffold/filer.toml @@ -262,6 +262,8 @@ routeByLatency = false [etcd] enabled = false servers = "localhost:2379" +username = "" +password = "" timeout = "3s" [mongodb] diff --git a/weed/filer/etcd/etcd_store.go b/weed/filer/etcd/etcd_store.go index b2e0fedda..50bfa4d8c 100644 --- a/weed/filer/etcd/etcd_store.go +++ b/weed/filer/etcd/etcd_store.go @@ -37,15 +37,18 @@ func (store *EtcdStore) Initialize(configuration weed_util.Configuration, prefix servers = "localhost:2379" } + username := configuration.GetString(prefix + "username") + password := configuration.GetString(prefix + "password") + timeout := configuration.GetString(prefix + "timeout") if timeout == "" { timeout = "3s" } - return store.initialize(servers, timeout) + return store.initialize(servers, username, password, timeout) } -func (store *EtcdStore) initialize(servers string, timeout string) (err error) { +func (store *EtcdStore) initialize(servers string, username string, password string, timeout string) (err error) { glog.Infof("filer store etcd: %s", servers) to, err := time.ParseDuration(timeout) @@ -55,6 +58,8 @@ func (store *EtcdStore) initialize(servers string, timeout string) (err error) { store.client, err = clientv3.New(clientv3.Config{ Endpoints: strings.Split(servers, ","), + Username: username, + Password: password, DialTimeout: to, }) if err != nil { |
