Commit 4f829af7 authored by astaxie's avatar astaxie

gofmt the config default

parent 9f2a2507
......@@ -194,135 +194,47 @@ func ParseConfig() (err error) {
BConfig.RunMode = runmode
}
BConfig.AppName = AppConfig.DefaultString("AppName", BConfig.AppName)
BConfig.RecoverPanic = AppConfig.DefaultBool("RecoverPanic", BConfig.RecoverPanic)
BConfig.RouterCaseSensitive = AppConfig.DefaultBool("RouterCaseSensitive", BConfig.RouterCaseSensitive)
BConfig.ServerName = AppConfig.DefaultString("BeegoServerName", BConfig.ServerName)
BConfig.EnableGzip = AppConfig.DefaultBool("EnableGzip", BConfig.EnableGzip)
BConfig.EnableErrorsShow = AppConfig.DefaultBool("EnableErrorsShow", BConfig.EnableErrorsShow)
BConfig.CopyRequestBody = AppConfig.DefaultBool("CopyRequestBody", BConfig.CopyRequestBody)
BConfig.MaxMemory = AppConfig.DefaultInt64("MaxMemory", BConfig.MaxMemory)
BConfig.Listen.Graceful = AppConfig.DefaultBool("Graceful", BConfig.Listen.Graceful)
BConfig.Listen.HTTPAddr = AppConfig.String("HTTPAddr")
if v, err := AppConfig.Int("HTTPPort"); err == nil {
BConfig.Listen.HTTPPort = v
}
if v, err := AppConfig.Bool("ListenTCP4"); err == nil {
BConfig.Listen.ListenTCP4 = v
}
if v, err := AppConfig.Bool("EnableHTTPListen"); err == nil {
BConfig.Listen.HTTPEnable = v
}
if maxmemory, err := AppConfig.Int64("MaxMemory"); err == nil {
BConfig.MaxMemory = maxmemory
}
if appname := AppConfig.String("AppName"); appname != "" {
BConfig.AppName = appname
}
if autorender, err := AppConfig.Bool("AutoRender"); err == nil {
BConfig.WebConfig.AutoRender = autorender
}
if autorecover, err := AppConfig.Bool("RecoverPanic"); err == nil {
BConfig.RecoverPanic = autorecover
}
if views := AppConfig.String("ViewsPath"); views != "" {
BConfig.WebConfig.ViewsPath = views
}
if sessionon, err := AppConfig.Bool("SessionOn"); err == nil {
BConfig.WebConfig.Session.SessionOn = sessionon
}
if sessProvider := AppConfig.String("SessionProvider"); sessProvider != "" {
BConfig.WebConfig.Session.SessionProvider = sessProvider
}
if sessName := AppConfig.String("SessionName"); sessName != "" {
BConfig.WebConfig.Session.SessionName = sessName
}
if sessProvConfig := AppConfig.String("SessionProviderConfig"); sessProvConfig != "" {
BConfig.WebConfig.Session.SessionProviderConfig = sessProvConfig
}
if sessMaxLifeTime, err := AppConfig.Int64("SessionGCMaxLifetime"); err == nil && sessMaxLifeTime != 0 {
BConfig.WebConfig.Session.SessionGCMaxLifetime = sessMaxLifeTime
}
if sesscookielifetime, err := AppConfig.Int("SessionCookieLifeTime"); err == nil && sesscookielifetime != 0 {
BConfig.WebConfig.Session.SessionCookieLifeTime = sesscookielifetime
}
if enableFcgi, err := AppConfig.Bool("EnableFcgi"); err == nil {
BConfig.Listen.EnableFcgi = enableFcgi
}
if enablegzip, err := AppConfig.Bool("EnableGzip"); err == nil {
BConfig.EnableGzip = enablegzip
}
if directoryindex, err := AppConfig.Bool("DirectoryIndex"); err == nil {
BConfig.WebConfig.DirectoryIndex = directoryindex
}
if timeout, err := AppConfig.Int64("HTTPServerTimeOut"); err == nil {
BConfig.Listen.ServerTimeOut = timeout
}
if errorsshow, err := AppConfig.Bool("EnableErrorsShow"); err == nil {
BConfig.EnableErrorsShow = errorsshow
}
if copyrequestbody, err := AppConfig.Bool("CopyRequestBody"); err == nil {
BConfig.CopyRequestBody = copyrequestbody
}
if xsrfkey := AppConfig.String("XSRFKEY"); xsrfkey != "" {
BConfig.WebConfig.XSRFKEY = xsrfkey
}
if enablexsrf, err := AppConfig.Bool("EnableXSRF"); err == nil {
BConfig.WebConfig.EnableXSRF = enablexsrf
}
if expire, err := AppConfig.Int("XSRFExpire"); err == nil {
BConfig.WebConfig.XSRFExpire = expire
}
if tplleft := AppConfig.String("TemplateLeft"); tplleft != "" {
BConfig.WebConfig.TemplateLeft = tplleft
}
if tplright := AppConfig.String("TemplateRight"); tplright != "" {
BConfig.WebConfig.TemplateRight = tplright
}
if httptls, err := AppConfig.Bool("EnableHTTPTLS"); err == nil {
BConfig.Listen.HTTPSEnable = httptls
}
if httpsport, err := AppConfig.Int("HTTPSPort"); err == nil {
BConfig.Listen.HTTPSPort = httpsport
}
if certfile := AppConfig.String("HTTPCertFile"); certfile != "" {
BConfig.Listen.HTTPSCertFile = certfile
}
if keyfile := AppConfig.String("HTTPKeyFile"); keyfile != "" {
BConfig.Listen.HTTPSKeyFile = keyfile
}
if serverName := AppConfig.String("BeegoServerName"); serverName != "" {
BConfig.ServerName = serverName
}
if flashname := AppConfig.String("FlashName"); flashname != "" {
BConfig.WebConfig.FlashName = flashname
}
if flashseperator := AppConfig.String("FlashSeperator"); flashseperator != "" {
BConfig.WebConfig.FlashSeperator = flashseperator
}
BConfig.Listen.HTTPPort = AppConfig.DefaultInt("HTTPPort", BConfig.Listen.HTTPPort)
BConfig.Listen.ListenTCP4 = AppConfig.DefaultBool("ListenTCP4", BConfig.Listen.ListenTCP4)
BConfig.Listen.HTTPEnable = AppConfig.DefaultBool("EnableHTTPListen", BConfig.Listen.HTTPEnable)
BConfig.Listen.HTTPSEnable = AppConfig.DefaultBool("EnableHTTPTLS", BConfig.Listen.HTTPSEnable)
BConfig.Listen.HTTPSPort = AppConfig.DefaultInt("HTTPSPort", BConfig.Listen.HTTPSPort)
BConfig.Listen.HTTPSCertFile = AppConfig.DefaultString("HTTPCertFile", BConfig.Listen.HTTPSCertFile)
BConfig.Listen.HTTPSKeyFile = AppConfig.DefaultString("HTTPKeyFile", BConfig.Listen.HTTPSKeyFile)
BConfig.Listen.AdminEnable = AppConfig.DefaultBool("EnableAdmin", BConfig.Listen.AdminEnable)
BConfig.Listen.AdminAddr = AppConfig.DefaultString("AdminHTTPAddr", BConfig.Listen.AdminAddr)
BConfig.Listen.AdminPort = AppConfig.DefaultInt("AdminHTTPPort", BConfig.Listen.AdminPort)
BConfig.Listen.EnableFcgi = AppConfig.DefaultBool("EnableFcgi", BConfig.Listen.EnableFcgi)
BConfig.Listen.ServerTimeOut = AppConfig.DefaultInt64("HTTPServerTimeOut", BConfig.Listen.ServerTimeOut)
BConfig.WebConfig.AutoRender = AppConfig.DefaultBool("AutoRender", BConfig.WebConfig.AutoRender)
BConfig.WebConfig.ViewsPath = AppConfig.DefaultString("ViewsPath", BConfig.WebConfig.ViewsPath)
BConfig.WebConfig.DirectoryIndex = AppConfig.DefaultBool("DirectoryIndex", BConfig.WebConfig.DirectoryIndex)
BConfig.WebConfig.XSRFKEY = AppConfig.DefaultString("XSRFKEY", BConfig.WebConfig.XSRFKEY)
BConfig.WebConfig.EnableXSRF = AppConfig.DefaultBool("EnableXSRF", BConfig.WebConfig.EnableXSRF)
BConfig.WebConfig.XSRFExpire = AppConfig.DefaultInt("XSRFExpire", BConfig.WebConfig.XSRFExpire)
BConfig.WebConfig.TemplateLeft = AppConfig.DefaultString("TemplateLeft", BConfig.WebConfig.TemplateLeft)
BConfig.WebConfig.TemplateRight = AppConfig.DefaultString("TemplateRight", BConfig.WebConfig.TemplateRight)
BConfig.WebConfig.Session.SessionOn = AppConfig.DefaultBool("SessionOn", BConfig.WebConfig.Session.SessionOn)
BConfig.WebConfig.Session.SessionProvider = AppConfig.DefaultString("SessionProvider", BConfig.WebConfig.Session.SessionProvider)
BConfig.WebConfig.Session.SessionName = AppConfig.DefaultString("SessionName", BConfig.WebConfig.Session.SessionName)
BConfig.WebConfig.Session.SessionProviderConfig = AppConfig.DefaultString("SessionProviderConfig", BConfig.WebConfig.Session.SessionProviderConfig)
BConfig.WebConfig.Session.SessionGCMaxLifetime = AppConfig.DefaultInt64("SessionGCMaxLifetime", BConfig.WebConfig.Session.SessionGCMaxLifetime)
BConfig.WebConfig.Session.SessionCookieLifeTime = AppConfig.DefaultInt("SessionCookieLifeTime", BConfig.WebConfig.Session.SessionCookieLifeTime)
BConfig.WebConfig.FlashName = AppConfig.DefaultString("FlashName", BConfig.WebConfig.FlashName)
BConfig.WebConfig.FlashSeperator = AppConfig.DefaultString("FlashSeperator", BConfig.WebConfig.FlashSeperator)
BConfig.WebConfig.EnableDocs = AppConfig.DefaultBool("EnableDocs", BConfig.WebConfig.EnableDocs)
if sd := AppConfig.String("StaticDir"); sd != "" {
for k := range BConfig.WebConfig.StaticDir {
......@@ -355,29 +267,6 @@ func ParseConfig() (err error) {
BConfig.WebConfig.StaticExtensionsToGzip = fileExts
}
}
if enableadmin, err := AppConfig.Bool("EnableAdmin"); err == nil {
BConfig.Listen.AdminEnable = enableadmin
}
if adminhttpaddr := AppConfig.String("AdminHTTPAddr"); adminhttpaddr != "" {
BConfig.Listen.AdminAddr = adminhttpaddr
}
if adminhttpport, err := AppConfig.Int("AdminHTTPPort"); err == nil {
BConfig.Listen.AdminPort = adminhttpport
}
if enabledocs, err := AppConfig.Bool("EnableDocs"); err == nil {
BConfig.WebConfig.EnableDocs = enabledocs
}
if casesensitive, err := AppConfig.Bool("RouterCaseSensitive"); err == nil {
BConfig.RouterCaseSensitive = casesensitive
}
if graceful, err := AppConfig.Bool("Graceful"); err == nil {
BConfig.Listen.Graceful = graceful
}
return nil
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment