Use constants for gateway names to avoid bugs caused by spelling. (#10355)

This commit is contained in:
飞雪无情
2020-08-26 23:52:46 +08:00
committed by GitHub
parent ea5094e842
commit ea1803417f
9 changed files with 31 additions and 37 deletions

View File

@@ -262,8 +262,8 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
}
// Currently only NAS and S3 gateway support encryption headers.
encryptionEnabled := gatewayName == "s3" || gatewayName == "nas"
allowSSEKMS := gatewayName == "s3" // Only S3 can support SSE-KMS (as pass-through)
encryptionEnabled := gatewayName == S3BackendGateway || gatewayName == NASBackendGateway
allowSSEKMS := gatewayName == S3BackendGateway // Only S3 can support SSE-KMS (as pass-through)
// Add API router.
registerAPIRouter(router, encryptionEnabled, allowSSEKMS)
@@ -310,7 +310,7 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
// Calls all New() for all sub-systems.
newAllSubsystems()
if gatewayName == "nas" {
if gatewayName == NASBackendGateway {
buckets, err := newObject.ListBuckets(GlobalContext)
if err != nil {
logger.Fatal(err, "Unable to list buckets")