mirror of
https://github.com/minio/minio.git
synced 2024-12-25 14:45:54 -05:00
aaf97ea02c
- New config format. ``` { "version": "3", "address": ":9000", "backend": { "type": "fs", "disk": "/path" }, "credential": { "accessKey": "WLGDGYAQYIGI833EV05A", "secretKey": "BYvgJM101sHngl2uzjXS/OBF/aMxAN06JrJ3qJlF" }, "region": "us-east-1", "logger": { "file": { "enable": false, "fileName": "", "level": "error" }, "syslog": { "enable": false, "address": "", "level": "debug" }, "console": { "enable": true, "level": "fatal" } } } ``` New command lines in lieu of supporting XL. Minio initialize filesystem backend. ~~~ $ minio init fs <path> ~~~ Minio initialize XL backend. ~~~ $ minio init xl <url1>...<url16> ~~~ For 'fs' backend it starts the server. ~~~ $ minio server ~~~ For 'xl' backend it waits for servers to join. ~~~ $ minio server ... [PROGRESS BAR] of servers connecting ~~~ Now on other servers execute 'join' and they connect. ~~~ .... minio join <url1> -- from <url2> && minio server minio join <url1> -- from <url3> && minio server ... ... minio join <url1> -- from <url16> && minio server ~~~
82 lines
1.9 KiB
Go
82 lines
1.9 KiB
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/minio/minio/pkg/probe"
|
|
"github.com/minio/minio/pkg/quick"
|
|
)
|
|
|
|
/////////////////// Config V1 ///////////////////
|
|
type configV1 struct {
|
|
Version string `json:"version"`
|
|
AccessKeyID string `json:"accessKeyId"`
|
|
SecretAccessKey string `json:"secretAccessKey"`
|
|
}
|
|
|
|
// loadConfigV1 load config
|
|
func loadConfigV1() (*configV1, *probe.Error) {
|
|
configPath, err := getConfigPath()
|
|
if err != nil {
|
|
return nil, err.Trace()
|
|
}
|
|
configFile := filepath.Join(configPath, "fsUsers.json")
|
|
if _, err := os.Stat(configFile); err != nil {
|
|
return nil, probe.NewError(err)
|
|
}
|
|
a := &configV1{}
|
|
a.Version = "1"
|
|
qc, err := quick.New(a)
|
|
if err != nil {
|
|
return nil, err.Trace()
|
|
}
|
|
if err := qc.Load(configFile); err != nil {
|
|
return nil, err.Trace()
|
|
}
|
|
return qc.Data().(*configV1), nil
|
|
}
|
|
|
|
/////////////////// Config V2 ///////////////////
|
|
type configV2 struct {
|
|
Version string `json:"version"`
|
|
Credentials struct {
|
|
AccessKeyID string `json:"accessKeyId"`
|
|
SecretAccessKey string `json:"secretAccessKey"`
|
|
Region string `json:"region"`
|
|
} `json:"credentials"`
|
|
MongoLogger struct {
|
|
Addr string `json:"addr"`
|
|
DB string `json:"db"`
|
|
Collection string `json:"collection"`
|
|
} `json:"mongoLogger"`
|
|
SyslogLogger struct {
|
|
Network string `json:"network"`
|
|
Addr string `json:"addr"`
|
|
} `json:"syslogLogger"`
|
|
FileLogger struct {
|
|
Filename string `json:"filename"`
|
|
} `json:"fileLogger"`
|
|
}
|
|
|
|
// loadConfigV2 load config version '2'.
|
|
func loadConfigV2() (*configV2, *probe.Error) {
|
|
configFile, err := getConfigFile()
|
|
if err != nil {
|
|
return nil, err.Trace()
|
|
}
|
|
if _, err := os.Stat(configFile); err != nil {
|
|
return nil, probe.NewError(err)
|
|
}
|
|
a := &configV2{}
|
|
a.Version = "2"
|
|
qc, err := quick.New(a)
|
|
if err != nil {
|
|
return nil, err.Trace()
|
|
}
|
|
if err := qc.Load(configFile); err != nil {
|
|
return nil, err.Trace()
|
|
}
|
|
return qc.Data().(*configV2), nil
|
|
}
|