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) {
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()

View File

@ -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