From 1e5e213d249ed4498dad4e08b923befc2a339e3a Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 6 Oct 2016 13:35:56 -0700 Subject: [PATCH] auth: Make sure we initialize or change config before RPC requests. (#2867) --- cmd/server-main.go | 9 ++++++--- docker-compose.yml | 16 ++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/cmd/server-main.go b/cmd/server-main.go index f1d339eb8..2e18ef314 100644 --- a/cmd/server-main.go +++ b/cmd/server-main.go @@ -185,11 +185,13 @@ func initServerConfig(c *cli.Context) { if !isValidSecretKey.MatchString(secretKey) { fatalIf(errInvalidArgument, "Invalid secret key.") } + // Set new credentials. serverConfig.SetCredential(credential{ AccessKeyID: accessKey, SecretAccessKey: secretKey, }) + // Save new config. err = serverConfig.Save() fatalIf(err, "Unable to save config.") @@ -198,6 +200,7 @@ func initServerConfig(c *cli.Context) { // Set maxOpenFiles, This is necessary since default operating // system limits of 1024, 2048 are not enough for Minio server. setMaxOpenFiles() + // Set maxMemory, This is necessary since default operating // system limits might be changed and we need to make sure we // do not crash the server so the set the maxCacheSize appropriately. @@ -336,12 +339,12 @@ func serverMain(c *cli.Context) { // Disks to be used in server init. disks := c.Args() - // Check 'server' cli arguments. - storageDisks := validateDisks(disks, ignoredDisks) - // Initialize server config. initServerConfig(c) + // Check 'server' cli arguments. + storageDisks := validateDisks(disks, ignoredDisks) + // If https. tls := isSSL() diff --git a/docker-compose.yml b/docker-compose.yml index f8f6adfe6..a4779803d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,8 +11,8 @@ services: volumes: - /mnt/export/minio1:/export environment: - MINIO_ACCESS_KEY: abcd1 - MINIO_SECRET_KEY: abcd1234 + MINIO_ACCESS_KEY: minio + MINIO_SECRET_KEY: minio123 command: minio1:/export minio2:/export minio3:/export minio4:/export minio2: image: minio/minio:edge @@ -21,8 +21,8 @@ services: volumes: - /mnt/export/minio2:/export environment: - MINIO_ACCESS_KEY: abcd1 - MINIO_SECRET_KEY: abcd1234 + MINIO_ACCESS_KEY: minio + MINIO_SECRET_KEY: minio123 command: minio1:/export minio2:/export minio3:/export minio4:/export minio3: image: minio/minio:edge @@ -31,8 +31,8 @@ services: volumes: - /mnt/export/minio3:/export environment: - MINIO_ACCESS_KEY: abcd1 - MINIO_SECRET_KEY: abcd1234 + MINIO_ACCESS_KEY: minio + MINIO_SECRET_KEY: minio123 command: minio1:/export minio2:/export minio3:/export minio4:/export minio4: image: minio/minio:edge @@ -41,6 +41,6 @@ services: volumes: - /mnt/export/minio4:/export environment: - MINIO_ACCESS_KEY: abcd1 - MINIO_SECRET_KEY: abcd1234 + MINIO_ACCESS_KEY: minio + MINIO_SECRET_KEY: minio123 command: minio1:/export minio2:/export minio3:/export minio4:/export