auth: Make sure we initialize or change config before RPC requests. (#2867)

This commit is contained in:
Harshavardhana 2016-10-06 13:35:56 -07:00 committed by GitHub
parent a8105ec068
commit 1e5e213d24
2 changed files with 14 additions and 11 deletions

View File

@ -185,11 +185,13 @@ func initServerConfig(c *cli.Context) {
if !isValidSecretKey.MatchString(secretKey) { if !isValidSecretKey.MatchString(secretKey) {
fatalIf(errInvalidArgument, "Invalid secret key.") fatalIf(errInvalidArgument, "Invalid secret key.")
} }
// Set new credentials. // Set new credentials.
serverConfig.SetCredential(credential{ serverConfig.SetCredential(credential{
AccessKeyID: accessKey, AccessKeyID: accessKey,
SecretAccessKey: secretKey, SecretAccessKey: secretKey,
}) })
// Save new config. // Save new config.
err = serverConfig.Save() err = serverConfig.Save()
fatalIf(err, "Unable to save config.") fatalIf(err, "Unable to save config.")
@ -198,6 +200,7 @@ func initServerConfig(c *cli.Context) {
// Set maxOpenFiles, This is necessary since default operating // Set maxOpenFiles, This is necessary since default operating
// system limits of 1024, 2048 are not enough for Minio server. // system limits of 1024, 2048 are not enough for Minio server.
setMaxOpenFiles() setMaxOpenFiles()
// Set maxMemory, This is necessary since default operating // Set maxMemory, This is necessary since default operating
// system limits might be changed and we need to make sure we // system limits might be changed and we need to make sure we
// do not crash the server so the set the maxCacheSize appropriately. // 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 to be used in server init.
disks := c.Args() disks := c.Args()
// Check 'server' cli arguments.
storageDisks := validateDisks(disks, ignoredDisks)
// Initialize server config. // Initialize server config.
initServerConfig(c) initServerConfig(c)
// Check 'server' cli arguments.
storageDisks := validateDisks(disks, ignoredDisks)
// If https. // If https.
tls := isSSL() tls := isSSL()

View File

@ -11,8 +11,8 @@ services:
volumes: volumes:
- /mnt/export/minio1:/export - /mnt/export/minio1:/export
environment: environment:
MINIO_ACCESS_KEY: abcd1 MINIO_ACCESS_KEY: minio
MINIO_SECRET_KEY: abcd1234 MINIO_SECRET_KEY: minio123
command: minio1:/export minio2:/export minio3:/export minio4:/export command: minio1:/export minio2:/export minio3:/export minio4:/export
minio2: minio2:
image: minio/minio:edge image: minio/minio:edge
@ -21,8 +21,8 @@ services:
volumes: volumes:
- /mnt/export/minio2:/export - /mnt/export/minio2:/export
environment: environment:
MINIO_ACCESS_KEY: abcd1 MINIO_ACCESS_KEY: minio
MINIO_SECRET_KEY: abcd1234 MINIO_SECRET_KEY: minio123
command: minio1:/export minio2:/export minio3:/export minio4:/export command: minio1:/export minio2:/export minio3:/export minio4:/export
minio3: minio3:
image: minio/minio:edge image: minio/minio:edge
@ -31,8 +31,8 @@ services:
volumes: volumes:
- /mnt/export/minio3:/export - /mnt/export/minio3:/export
environment: environment:
MINIO_ACCESS_KEY: abcd1 MINIO_ACCESS_KEY: minio
MINIO_SECRET_KEY: abcd1234 MINIO_SECRET_KEY: minio123
command: minio1:/export minio2:/export minio3:/export minio4:/export command: minio1:/export minio2:/export minio3:/export minio4:/export
minio4: minio4:
image: minio/minio:edge image: minio/minio:edge
@ -41,6 +41,6 @@ services:
volumes: volumes:
- /mnt/export/minio4:/export - /mnt/export/minio4:/export
environment: environment:
MINIO_ACCESS_KEY: abcd1 MINIO_ACCESS_KEY: minio
MINIO_SECRET_KEY: abcd1234 MINIO_SECRET_KEY: minio123
command: minio1:/export minio2:/export minio3:/export minio4:/export command: minio1:/export minio2:/export minio3:/export minio4:/export