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