aboutsummaryrefslogtreecommitdiff
path: root/weed/server/volume_server.go
diff options
context:
space:
mode:
authorKonstantin Lebedev <9497591+kmlebedev@users.noreply.github.com>2024-12-02 23:38:10 +0500
committerGitHub <noreply@github.com>2024-12-02 10:38:10 -0800
commitb65eb2ec4569891495ae184bf6090e0e500961e3 (patch)
tree92b75ea55a544a066f657e12fc9745a78f26baa5 /weed/server/volume_server.go
parentb2ba7d7408500bb450884a288327a1fb53e67fae (diff)
downloadseaweedfs-b65eb2ec4569891495ae184bf6090e0e500961e3.tar.xz
seaweedfs-b65eb2ec4569891495ae184bf6090e0e500961e3.zip
[security] reload whiteList on http seerver (#6302)
* reload whiteList * white_list add to scaffold
Diffstat (limited to 'weed/server/volume_server.go')
-rw-r--r--weed/server/volume_server.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/weed/server/volume_server.go b/weed/server/volume_server.go
index 5d7e5c7b0..a3f072eb7 100644
--- a/weed/server/volume_server.go
+++ b/weed/server/volume_server.go
@@ -32,6 +32,7 @@ type VolumeServer struct {
readBufferSizeMB int
SeedMasterNodes []pb.ServerAddress
+ whiteList []string
currentMaster pb.ServerAddress
pulseSeconds int
dataCenter string
@@ -102,7 +103,10 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,
hasSlowRead: hasSlowRead,
readBufferSizeMB: readBufferSizeMB,
ldbTimout: ldbTimeout,
+ whiteList: whiteList,
}
+
+ whiteList = append(whiteList, util.StringSplit(v.GetString("guard.white_list"), ",")...)
vs.SeedMasterNodes = masterNodes
vs.checkWithMaster()
@@ -150,3 +154,11 @@ func (vs *VolumeServer) Shutdown() {
vs.store.Close()
glog.V(0).Infoln("Shut down successfully!")
}
+
+func (vs *VolumeServer) Reload() {
+ glog.V(0).Infoln("Reload volume server...")
+
+ util.LoadConfiguration("security", false)
+ v := util.GetViper()
+ vs.guard.UpdateWhiteList(append(vs.whiteList, util.StringSplit(v.GetString("guard.white_list"), ",")...))
+}