Add logger command - also migrate from old config to newer config

This commit is contained in:
Harshavardhana
2015-10-20 00:33:53 -07:00
parent e8892a9f3c
commit 56003fded7
13 changed files with 538 additions and 188 deletions

29
main.go
View File

@@ -22,33 +22,11 @@ import (
"os/user"
"runtime"
"strconv"
"time"
"github.com/dustin/go-humanize"
"github.com/minio/cli"
)
// serverConfig - http server config
type serverConfig struct {
/// HTTP server options
Address string // Address:Port listening
AccessLog bool // Enable access log handler
Anonymous bool // No signature turn off
/// FS options
Path string // Path to export for cloud storage
MinFreeDisk int64 // Minimum free disk space for filesystem
Expiry time.Duration // Set auto expiry for filesystem
// TLS service
TLS bool // TLS on when certs are specified
CertFile string // Domain certificate
KeyFile string // Domain key
/// Advanced HTTP server options
RateLimit int // Ratelimited server of incoming connections
}
func init() {
// Check for the environment early on and gracefuly report.
_, err := user.Current()
@@ -64,6 +42,11 @@ func init() {
checkGolangRuntimeVersion()
}
func migrate() {
// Migrate config file
migrateConfig()
}
// Tries to get os/arch/platform specific information
// Returns a map of current os/arch/platform/memstats
func getSystemData() map[string]string {
@@ -101,6 +84,7 @@ func findClosestCommands(command string) []string {
func registerApp() *cli.App {
// register all commands
registerCommand(serverCmd)
registerCommand(configCmd)
registerCommand(versionCmd)
registerCommand(updateCmd)
@@ -166,6 +150,7 @@ func main() {
app := registerApp()
app.Before = func(c *cli.Context) error {
globalJSONFlag = c.GlobalBool("json")
migrate()
return nil
}
app.ExtraInfo = func() map[string]string {