mirror of
https://github.com/minio/minio.git
synced 2025-04-01 02:03:42 -04:00
* I needed to remove the region check from PutBucketHandler
This commit is contained in:
parent
07949f68d8
commit
0a8cf1a6b0
@ -206,10 +206,8 @@ func (l *gcsGateway) MakeBucket(bucket string) error {
|
|||||||
func (l *gcsGateway) MakeBucketWithLocation(bucket, location string) error {
|
func (l *gcsGateway) MakeBucketWithLocation(bucket, location string) error {
|
||||||
bkt := l.client.Bucket(bucket)
|
bkt := l.client.Bucket(bucket)
|
||||||
|
|
||||||
// TODO: location
|
|
||||||
_ = location
|
|
||||||
if err := bkt.Create(l.ctx, l.projectID, &storage.BucketAttrs{
|
if err := bkt.Create(l.ctx, l.projectID, &storage.BucketAttrs{
|
||||||
Location: "US",
|
Location: location,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return gcsToObjectError(traceError(err), bucket)
|
return gcsToObjectError(traceError(err), bucket)
|
||||||
}
|
}
|
||||||
|
@ -651,15 +651,6 @@ func (api gatewayAPIHandlers) PutBucketHandler(w http.ResponseWriter, r *http.Re
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// validating region here, because isValidLocationConstraint
|
|
||||||
// reads body which has been read already. So only validating
|
|
||||||
// region here.
|
|
||||||
serverRegion := serverConfig.GetRegion()
|
|
||||||
if serverRegion != location {
|
|
||||||
writeErrorResponse(w, ErrInvalidRegion, r.URL)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
bucketLock := globalNSMutex.NewNSLock(bucket, "")
|
bucketLock := globalNSMutex.NewNSLock(bucket, "")
|
||||||
bucketLock.Lock()
|
bucketLock.Lock()
|
||||||
defer bucketLock.Unlock()
|
defer bucketLock.Unlock()
|
||||||
|
@ -180,14 +180,20 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Returns access and secretkey set from environment variables.
|
// Returns access and secretkey set from environment variables.
|
||||||
func mustGetGatewayCredsFromEnv() (accessKey, secretKey string) {
|
func mustGetGatewayConfigFromEnv() (string, string, string) {
|
||||||
// Fetch access keys from environment variables.
|
// Fetch access keys from environment variables.
|
||||||
accessKey = os.Getenv("MINIO_ACCESS_KEY")
|
accessKey := os.Getenv("MINIO_ACCESS_KEY")
|
||||||
secretKey = os.Getenv("MINIO_SECRET_KEY")
|
secretKey := os.Getenv("MINIO_SECRET_KEY")
|
||||||
if accessKey == "" || secretKey == "" {
|
if accessKey == "" || secretKey == "" {
|
||||||
fatalIf(errors.New("Missing credentials"), "Access and secret keys are mandatory to run Minio gateway server.")
|
fatalIf(errors.New("Missing credentials"), "Access and secret keys are mandatory to run Minio gateway server.")
|
||||||
}
|
}
|
||||||
return accessKey, secretKey
|
|
||||||
|
region := globalMinioDefaultRegion
|
||||||
|
if v := os.Getenv("MINIO_REGION"); v != "" {
|
||||||
|
region = v
|
||||||
|
}
|
||||||
|
|
||||||
|
return accessKey, secretKey, region
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set browser setting from environment variables
|
// Set browser setting from environment variables
|
||||||
@ -336,14 +342,13 @@ func gcsGatewayMain(ctx *cli.Context) {
|
|||||||
// Handler for 'minio gateway'.
|
// Handler for 'minio gateway'.
|
||||||
func gatewayMain(ctx *cli.Context, backendType gatewayBackend) {
|
func gatewayMain(ctx *cli.Context, backendType gatewayBackend) {
|
||||||
// Fetch access and secret key from env.
|
// Fetch access and secret key from env.
|
||||||
accessKey, secretKey := mustGetGatewayCredsFromEnv()
|
accessKey, secretKey, region := mustGetGatewayConfigFromEnv()
|
||||||
|
|
||||||
// Fetch browser env setting
|
// Fetch browser env setting
|
||||||
mustSetBrowserSettingFromEnv()
|
mustSetBrowserSettingFromEnv()
|
||||||
|
|
||||||
// Initialize new gateway config.
|
// Initialize new gateway config.
|
||||||
|
newGatewayConfig(accessKey, secretKey, region)
|
||||||
newGatewayConfig(accessKey, secretKey, globalMinioDefaultRegion)
|
|
||||||
|
|
||||||
// Get quiet flag from command line argument.
|
// Get quiet flag from command line argument.
|
||||||
quietFlag := ctx.Bool("quiet") || ctx.GlobalBool("quiet")
|
quietFlag := ctx.Bool("quiet") || ctx.GlobalBool("quiet")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user