1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-25 02:40:54 +00:00

update some config name

This commit is contained in:
astaxie 2016-01-12 21:55:02 +08:00
parent b90a28bafb
commit 6660720ce6
5 changed files with 26 additions and 26 deletions

View File

@ -104,15 +104,15 @@ func listConf(rw http.ResponseWriter, r *http.Request) {
m["BConfig.Listen.Graceful"] = BConfig.Listen.Graceful m["BConfig.Listen.Graceful"] = BConfig.Listen.Graceful
m["BConfig.Listen.ServerTimeOut"] = BConfig.Listen.ServerTimeOut m["BConfig.Listen.ServerTimeOut"] = BConfig.Listen.ServerTimeOut
m["BConfig.Listen.ListenTCP4"] = BConfig.Listen.ListenTCP4 m["BConfig.Listen.ListenTCP4"] = BConfig.Listen.ListenTCP4
m["BConfig.Listen.HTTPEnable"] = BConfig.Listen.HTTPEnable m["BConfig.Listen.EnableHTTP"] = BConfig.Listen.EnableHTTP
m["BConfig.Listen.HTTPAddr"] = BConfig.Listen.HTTPAddr m["BConfig.Listen.HTTPAddr"] = BConfig.Listen.HTTPAddr
m["BConfig.Listen.HTTPPort"] = BConfig.Listen.HTTPPort m["BConfig.Listen.HTTPPort"] = BConfig.Listen.HTTPPort
m["BConfig.Listen.HTTPSEnable"] = BConfig.Listen.HTTPSEnable m["BConfig.Listen.EnableHTTPS"] = BConfig.Listen.EnableHTTPS
m["BConfig.Listen.HTTPSAddr"] = BConfig.Listen.HTTPSAddr m["BConfig.Listen.HTTPSAddr"] = BConfig.Listen.HTTPSAddr
m["BConfig.Listen.HTTPSPort"] = BConfig.Listen.HTTPSPort m["BConfig.Listen.HTTPSPort"] = BConfig.Listen.HTTPSPort
m["BConfig.Listen.HTTPSCertFile"] = BConfig.Listen.HTTPSCertFile m["BConfig.Listen.HTTPSCertFile"] = BConfig.Listen.HTTPSCertFile
m["BConfig.Listen.HTTPSKeyFile"] = BConfig.Listen.HTTPSKeyFile m["BConfig.Listen.HTTPSKeyFile"] = BConfig.Listen.HTTPSKeyFile
m["BConfig.Listen.AdminEnable"] = BConfig.Listen.AdminEnable m["BConfig.Listen.EnableAdmin"] = BConfig.Listen.EnableAdmin
m["BConfig.Listen.AdminAddr"] = BConfig.Listen.AdminAddr m["BConfig.Listen.AdminAddr"] = BConfig.Listen.AdminAddr
m["BConfig.Listen.AdminPort"] = BConfig.Listen.AdminPort m["BConfig.Listen.AdminPort"] = BConfig.Listen.AdminPort
m["BConfig.Listen.EnableFcgi"] = BConfig.Listen.EnableFcgi m["BConfig.Listen.EnableFcgi"] = BConfig.Listen.EnableFcgi

8
app.go
View File

@ -100,7 +100,7 @@ func (app *App) Run() {
if BConfig.Listen.Graceful { if BConfig.Listen.Graceful {
httpsAddr := BConfig.Listen.HTTPSAddr httpsAddr := BConfig.Listen.HTTPSAddr
app.Server.Addr = httpsAddr app.Server.Addr = httpsAddr
if BConfig.Listen.HTTPSEnable { if BConfig.Listen.EnableHTTPS {
go func() { go func() {
time.Sleep(20 * time.Microsecond) time.Sleep(20 * time.Microsecond)
if BConfig.Listen.HTTPSPort != 0 { if BConfig.Listen.HTTPSPort != 0 {
@ -117,7 +117,7 @@ func (app *App) Run() {
} }
}() }()
} }
if BConfig.Listen.HTTPEnable { if BConfig.Listen.EnableHTTP {
go func() { go func() {
server := grace.NewServer(addr, app.Handlers) server := grace.NewServer(addr, app.Handlers)
server.Server.ReadTimeout = app.Server.ReadTimeout server.Server.ReadTimeout = app.Server.ReadTimeout
@ -138,7 +138,7 @@ func (app *App) Run() {
// run normal mode // run normal mode
app.Server.Addr = addr app.Server.Addr = addr
if BConfig.Listen.HTTPSEnable { if BConfig.Listen.EnableHTTPS {
go func() { go func() {
time.Sleep(20 * time.Microsecond) time.Sleep(20 * time.Microsecond)
if BConfig.Listen.HTTPSPort != 0 { if BConfig.Listen.HTTPSPort != 0 {
@ -152,7 +152,7 @@ func (app *App) Run() {
} }
}() }()
} }
if BConfig.Listen.HTTPEnable { if BConfig.Listen.EnableHTTP {
go func() { go func() {
app.Server.Addr = addr app.Server.Addr = addr
BeeLogger.Info("http server Running on %s", app.Server.Addr) BeeLogger.Info("http server Running on %s", app.Server.Addr)

View File

@ -44,15 +44,15 @@ type Listen struct {
Graceful bool // Graceful means use graceful module to start the server Graceful bool // Graceful means use graceful module to start the server
ServerTimeOut int64 ServerTimeOut int64
ListenTCP4 bool ListenTCP4 bool
HTTPEnable bool EnableHTTP bool
HTTPAddr string HTTPAddr string
HTTPPort int HTTPPort int
HTTPSEnable bool EnableHTTPS bool
HTTPSAddr string HTTPSAddr string
HTTPSPort int HTTPSPort int
HTTPSCertFile string HTTPSCertFile string
HTTPSKeyFile string HTTPSKeyFile string
AdminEnable bool EnableAdmin bool
AdminAddr string AdminAddr string
AdminPort int AdminPort int
EnableFcgi bool EnableFcgi bool
@ -123,15 +123,15 @@ func init() {
Graceful: false, Graceful: false,
ServerTimeOut: 0, ServerTimeOut: 0,
ListenTCP4: false, ListenTCP4: false,
HTTPEnable: true, EnableHTTP: true,
HTTPAddr: "", HTTPAddr: "",
HTTPPort: 8080, HTTPPort: 8080,
HTTPSEnable: false, EnableHTTPS: false,
HTTPSAddr: "", HTTPSAddr: "",
HTTPSPort: 10443, HTTPSPort: 10443,
HTTPSCertFile: "", HTTPSCertFile: "",
HTTPSKeyFile: "", HTTPSKeyFile: "",
AdminEnable: false, EnableAdmin: false,
AdminAddr: "", AdminAddr: "",
AdminPort: 8088, AdminPort: 8088,
EnableFcgi: false, EnableFcgi: false,
@ -196,7 +196,7 @@ func ParseConfig() (err error) {
BConfig.AppName = AppConfig.DefaultString("AppName", BConfig.AppName) BConfig.AppName = AppConfig.DefaultString("AppName", BConfig.AppName)
BConfig.RecoverPanic = AppConfig.DefaultBool("RecoverPanic", BConfig.RecoverPanic) BConfig.RecoverPanic = AppConfig.DefaultBool("RecoverPanic", BConfig.RecoverPanic)
BConfig.RouterCaseSensitive = AppConfig.DefaultBool("RouterCaseSensitive", BConfig.RouterCaseSensitive) BConfig.RouterCaseSensitive = AppConfig.DefaultBool("RouterCaseSensitive", BConfig.RouterCaseSensitive)
BConfig.ServerName = AppConfig.DefaultString("BeegoServerName", BConfig.ServerName) BConfig.ServerName = AppConfig.DefaultString("ServerName", BConfig.ServerName)
BConfig.EnableGzip = AppConfig.DefaultBool("EnableGzip", BConfig.EnableGzip) BConfig.EnableGzip = AppConfig.DefaultBool("EnableGzip", BConfig.EnableGzip)
BConfig.EnableErrorsShow = AppConfig.DefaultBool("EnableErrorsShow", BConfig.EnableErrorsShow) BConfig.EnableErrorsShow = AppConfig.DefaultBool("EnableErrorsShow", BConfig.EnableErrorsShow)
BConfig.CopyRequestBody = AppConfig.DefaultBool("CopyRequestBody", BConfig.CopyRequestBody) BConfig.CopyRequestBody = AppConfig.DefaultBool("CopyRequestBody", BConfig.CopyRequestBody)
@ -205,18 +205,18 @@ func ParseConfig() (err error) {
BConfig.Listen.HTTPAddr = AppConfig.String("HTTPAddr") BConfig.Listen.HTTPAddr = AppConfig.String("HTTPAddr")
BConfig.Listen.HTTPPort = AppConfig.DefaultInt("HTTPPort", BConfig.Listen.HTTPPort) BConfig.Listen.HTTPPort = AppConfig.DefaultInt("HTTPPort", BConfig.Listen.HTTPPort)
BConfig.Listen.ListenTCP4 = AppConfig.DefaultBool("ListenTCP4", BConfig.Listen.ListenTCP4) BConfig.Listen.ListenTCP4 = AppConfig.DefaultBool("ListenTCP4", BConfig.Listen.ListenTCP4)
BConfig.Listen.HTTPEnable = AppConfig.DefaultBool("EnableHTTPListen", BConfig.Listen.HTTPEnable) BConfig.Listen.EnableHTTP = AppConfig.DefaultBool("EnableHTTP", BConfig.Listen.EnableHTTP)
BConfig.Listen.HTTPSEnable = AppConfig.DefaultBool("EnableHTTPTLS", BConfig.Listen.HTTPSEnable) BConfig.Listen.EnableHTTPS = AppConfig.DefaultBool("EnableHTTPS", BConfig.Listen.EnableHTTPS)
BConfig.Listen.HTTPSAddr = AppConfig.DefaultString("HTTPSAddr", BConfig.Listen.HTTPSAddr) BConfig.Listen.HTTPSAddr = AppConfig.DefaultString("HTTPSAddr", BConfig.Listen.HTTPSAddr)
BConfig.Listen.HTTPSPort = AppConfig.DefaultInt("HTTPSPort", BConfig.Listen.HTTPSPort) BConfig.Listen.HTTPSPort = AppConfig.DefaultInt("HTTPSPort", BConfig.Listen.HTTPSPort)
BConfig.Listen.HTTPSCertFile = AppConfig.DefaultString("HTTPCertFile", BConfig.Listen.HTTPSCertFile) BConfig.Listen.HTTPSCertFile = AppConfig.DefaultString("HTTPSCertFile", BConfig.Listen.HTTPSCertFile)
BConfig.Listen.HTTPSKeyFile = AppConfig.DefaultString("HTTPKeyFile", BConfig.Listen.HTTPSKeyFile) BConfig.Listen.HTTPSKeyFile = AppConfig.DefaultString("HTTPSKeyFile", BConfig.Listen.HTTPSKeyFile)
BConfig.Listen.AdminEnable = AppConfig.DefaultBool("EnableAdmin", BConfig.Listen.AdminEnable) BConfig.Listen.EnableAdmin = AppConfig.DefaultBool("EnableAdmin", BConfig.Listen.EnableAdmin)
BConfig.Listen.AdminAddr = AppConfig.DefaultString("AdminHTTPAddr", BConfig.Listen.AdminAddr) BConfig.Listen.AdminAddr = AppConfig.DefaultString("AdminAddr", BConfig.Listen.AdminAddr)
BConfig.Listen.AdminPort = AppConfig.DefaultInt("AdminHTTPPort", BConfig.Listen.AdminPort) BConfig.Listen.AdminPort = AppConfig.DefaultInt("AdminPort", BConfig.Listen.AdminPort)
BConfig.Listen.EnableFcgi = AppConfig.DefaultBool("EnableFcgi", BConfig.Listen.EnableFcgi) BConfig.Listen.EnableFcgi = AppConfig.DefaultBool("EnableFcgi", BConfig.Listen.EnableFcgi)
BConfig.Listen.EnableStdIo = AppConfig.DefaultBool("EnableStdIo", BConfig.Listen.EnableStdIo) BConfig.Listen.EnableStdIo = AppConfig.DefaultBool("EnableStdIo", BConfig.Listen.EnableStdIo)
BConfig.Listen.ServerTimeOut = AppConfig.DefaultInt64("HTTPServerTimeOut", BConfig.Listen.ServerTimeOut) BConfig.Listen.ServerTimeOut = AppConfig.DefaultInt64("ServerTimeOut", BConfig.Listen.ServerTimeOut)
BConfig.WebConfig.AutoRender = AppConfig.DefaultBool("AutoRender", BConfig.WebConfig.AutoRender) BConfig.WebConfig.AutoRender = AppConfig.DefaultBool("AutoRender", BConfig.WebConfig.AutoRender)
BConfig.WebConfig.ViewsPath = AppConfig.DefaultString("ViewsPath", BConfig.WebConfig.ViewsPath) BConfig.WebConfig.ViewsPath = AppConfig.DefaultString("ViewsPath", BConfig.WebConfig.ViewsPath)
BConfig.WebConfig.DirectoryIndex = AppConfig.DefaultBool("DirectoryIndex", BConfig.WebConfig.DirectoryIndex) BConfig.WebConfig.DirectoryIndex = AppConfig.DefaultBool("DirectoryIndex", BConfig.WebConfig.DirectoryIndex)

View File

@ -48,7 +48,7 @@ func registerSession() error {
"cookieName": BConfig.WebConfig.Session.SessionName, "cookieName": BConfig.WebConfig.Session.SessionName,
"gclifetime": BConfig.WebConfig.Session.SessionGCMaxLifetime, "gclifetime": BConfig.WebConfig.Session.SessionGCMaxLifetime,
"providerConfig": filepath.ToSlash(BConfig.WebConfig.Session.SessionProviderConfig), "providerConfig": filepath.ToSlash(BConfig.WebConfig.Session.SessionProviderConfig),
"secure": BConfig.Listen.HTTPSEnable, "secure": BConfig.Listen.EnableHTTPS,
"enableSetCookie": BConfig.WebConfig.Session.SessionAutoSetCookie, "enableSetCookie": BConfig.WebConfig.Session.SessionAutoSetCookie,
"domain": BConfig.WebConfig.Session.SessionDomain, "domain": BConfig.WebConfig.Session.SessionDomain,
"cookieLifeTime": BConfig.WebConfig.Session.SessionCookieLifeTime, "cookieLifeTime": BConfig.WebConfig.Session.SessionCookieLifeTime,
@ -88,7 +88,7 @@ func registerDocs() error {
} }
func registerAdmin() error { func registerAdmin() error {
if BConfig.Listen.AdminEnable { if BConfig.Listen.EnableAdmin {
go beeAdminApp.Run() go beeAdminApp.Run()
} }
return nil return nil

View File

@ -609,7 +609,7 @@ func (p *ControllerRegister) ServeHTTP(rw http.ResponseWriter, r *http.Request)
defer p.pool.Put(context) defer p.pool.Put(context)
defer p.recoverPanic(context) defer p.recoverPanic(context)
context.Output.EnableGzip=BConfig.EnableGzip context.Output.EnableGzip = BConfig.EnableGzip
if BConfig.RunMode == DEV { if BConfig.RunMode == DEV {
context.Output.Header("Server", BConfig.ServerName) context.Output.Header("Server", BConfig.ServerName)
@ -800,7 +800,7 @@ func (p *ControllerRegister) ServeHTTP(rw http.ResponseWriter, r *http.Request)
Admin: Admin:
timeDur := time.Since(startTime) timeDur := time.Since(startTime)
//admin module record QPS //admin module record QPS
if BConfig.Listen.AdminEnable { if BConfig.Listen.EnableAdmin {
if FilterMonitorFunc(r.Method, r.URL.Path, timeDur) { if FilterMonitorFunc(r.Method, r.URL.Path, timeDur) {
if runRouter != nil { if runRouter != nil {
go toolbox.StatisticsMap.AddStatistics(r.Method, r.URL.Path, runRouter.Name(), timeDur) go toolbox.StatisticsMap.AddStatistics(r.Method, r.URL.Path, runRouter.Name(), timeDur)