From c1d70f1f9eabc56a20f928f0af15e78ed971f34b Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Sat, 30 Jul 2016 14:55:20 -0700 Subject: [PATCH] server/config: Create 'certs' directory in initServerConfig(). (#2331) certs directory was created only if config was not present, our expectancy is we need 'certs' directory to be present all the time making it easier to be documented. --- config-v5.go | 9 +++------ server-main.go | 6 +++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/config-v5.go b/config-v5.go index 126e1499e..730ed383c 100644 --- a/config-v5.go +++ b/config-v5.go @@ -41,28 +41,25 @@ type serverConfigV5 struct { // initConfig - initialize server config. config version (called only once). func initConfig() error { if !isConfigFileExists() { + // Initialize server config. srvCfg := &serverConfigV5{} srvCfg.Version = globalMinioConfigVersion srvCfg.Region = "us-east-1" srvCfg.Credential = mustGenAccessKeys() + // Enable console logger by default on a fresh run. srvCfg.Logger.Console = consoleLogger{ Enable: true, Level: "fatal", } srvCfg.rwMutex = &sync.RWMutex{} + // Create config path. err := createConfigPath() if err != nil { return err } - // Create certs path. - err = createCertsPath() - if err != nil { - return err - } - // Save the new config globally. serverConfig = srvCfg diff --git a/server-main.go b/server-main.go index 60c6028d3..334e2ba9c 100644 --- a/server-main.go +++ b/server-main.go @@ -154,8 +154,12 @@ func finalizeEndpoints(tls bool, apiServer *http.Server) (endPoints []string) { // initServerConfig initialize server config. func initServerConfig(c *cli.Context) { + // Create certs path. + err := createCertsPath() + fatalIf(err, "Unable to create \"certs\" directory.") + // Save new config. - err := serverConfig.Save() + err = serverConfig.Save() fatalIf(err, "Unable to save config.") // Fetch max conn limit from environment variable.