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.
This commit is contained in:
Harshavardhana 2016-07-30 14:55:20 -07:00 committed by Anand Babu (AB) Periasamy
parent 9baf599c91
commit c1d70f1f9e
2 changed files with 8 additions and 7 deletions

View File

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

View File

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