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.
master
Harshavardhana 8 years ago committed by Anand Babu (AB) Periasamy
parent 9baf599c91
commit c1d70f1f9e
  1. 9
      config-v5.go
  2. 6
      server-main.go

@ -41,28 +41,25 @@ type serverConfigV5 struct {
// initConfig - initialize server config. config version (called only once). // initConfig - initialize server config. config version (called only once).
func initConfig() error { func initConfig() error {
if !isConfigFileExists() { if !isConfigFileExists() {
// Initialize server config.
srvCfg := &serverConfigV5{} srvCfg := &serverConfigV5{}
srvCfg.Version = globalMinioConfigVersion srvCfg.Version = globalMinioConfigVersion
srvCfg.Region = "us-east-1" srvCfg.Region = "us-east-1"
srvCfg.Credential = mustGenAccessKeys() srvCfg.Credential = mustGenAccessKeys()
// Enable console logger by default on a fresh run. // Enable console logger by default on a fresh run.
srvCfg.Logger.Console = consoleLogger{ srvCfg.Logger.Console = consoleLogger{
Enable: true, Enable: true,
Level: "fatal", Level: "fatal",
} }
srvCfg.rwMutex = &sync.RWMutex{} srvCfg.rwMutex = &sync.RWMutex{}
// Create config path. // Create config path.
err := createConfigPath() err := createConfigPath()
if err != nil { if err != nil {
return err return err
} }
// Create certs path.
err = createCertsPath()
if err != nil {
return err
}
// Save the new config globally. // Save the new config globally.
serverConfig = srvCfg serverConfig = srvCfg

@ -154,8 +154,12 @@ func finalizeEndpoints(tls bool, apiServer *http.Server) (endPoints []string) {
// initServerConfig initialize server config. // initServerConfig initialize server config.
func initServerConfig(c *cli.Context) { func initServerConfig(c *cli.Context) {
// Create certs path.
err := createCertsPath()
fatalIf(err, "Unable to create \"certs\" directory.")
// Save new config. // Save new config.
err := serverConfig.Save() err = serverConfig.Save()
fatalIf(err, "Unable to save config.") fatalIf(err, "Unable to save config.")
// Fetch max conn limit from environment variable. // Fetch max conn limit from environment variable.

Loading…
Cancel
Save