diff options
| author | Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> | 2023-10-19 11:26:49 +0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-18 23:26:49 -0700 |
| commit | 6c82d7ddfcaed124e5597acbfae07ddbcd9b9639 (patch) | |
| tree | ed1b5d9167292bfb9ab2ecaab80dbdaf00e81ee6 | |
| parent | 3df0e11ad330859c82ef0aa6c2f2215a51819c1a (diff) | |
| download | seaweedfs-6c82d7ddfcaed124e5597acbfae07ddbcd9b9639.tar.xz seaweedfs-6c82d7ddfcaed124e5597acbfae07ddbcd9b9639.zip | |
[s3] do reload s3 static config (#4923)
* do reload s3 config
* print error on reload s3 config
* print success msg
* Update weed/s3api/s3api_server.go
---------
Co-authored-by: Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.co>
Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
| -rw-r--r-- | weed/s3api/s3api_server.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/weed/s3api/s3api_server.go b/weed/s3api/s3api_server.go index e38aae23d..58251491f 100644 --- a/weed/s3api/s3api_server.go +++ b/weed/s3api/s3api_server.go @@ -4,7 +4,9 @@ import ( "context" "fmt" "github.com/seaweedfs/seaweedfs/weed/filer" + "github.com/seaweedfs/seaweedfs/weed/glog" "github.com/seaweedfs/seaweedfs/weed/pb/s3_pb" + "github.com/seaweedfs/seaweedfs/weed/util/grace" "net" "net/http" "strings" @@ -61,6 +63,15 @@ func NewS3ApiServer(router *mux.Router, option *S3ApiServerOption) (s3ApiServer filerGuard: security.NewGuard([]string{}, signingKey, expiresAfterSec, readSigningKey, readExpiresAfterSec), cb: NewCircuitBreaker(option), } + if option.Config != "" { + grace.OnReload(func() { + if err := s3ApiServer.iam.loadS3ApiConfigurationFromFile(option.Config); err != nil { + glog.Errorf("fail to load config file %s: %v", option.Config, err) + } else { + glog.V(0).Infof("Loaded %s identities from config file %s", len(s3ApiServer.iam.identities), option.Config) + } + }) + } s3ApiServer.bucketRegistry = NewBucketRegistry(s3ApiServer) if option.LocalFilerSocket == "" { s3ApiServer.client = &http.Client{Transport: &http.Transport{ |
