Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
6660720c
Commit
6660720c
authored
Jan 12, 2016
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update some config name
parent
b90a28ba
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
26 deletions
+26
-26
admin.go
admin.go
+3
-3
app.go
app.go
+4
-4
config.go
config.go
+15
-15
hooks.go
hooks.go
+2
-2
router.go
router.go
+2
-2
No files found.
admin.go
View file @
6660720c
...
...
@@ -104,15 +104,15 @@ func listConf(rw http.ResponseWriter, r *http.Request) {
m
[
"BConfig.Listen.Graceful"
]
=
BConfig
.
Listen
.
Graceful
m
[
"BConfig.Listen.ServerTimeOut"
]
=
BConfig
.
Listen
.
ServerTimeOut
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.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.HTTPSPort"
]
=
BConfig
.
Listen
.
HTTPSPort
m
[
"BConfig.Listen.HTTPSCertFile"
]
=
BConfig
.
Listen
.
HTTPSCertFile
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.AdminPort"
]
=
BConfig
.
Listen
.
AdminPort
m
[
"BConfig.Listen.EnableFcgi"
]
=
BConfig
.
Listen
.
EnableFcgi
...
...
app.go
View file @
6660720c
...
...
@@ -100,7 +100,7 @@ func (app *App) Run() {
if
BConfig
.
Listen
.
Graceful
{
httpsAddr
:=
BConfig
.
Listen
.
HTTPSAddr
app
.
Server
.
Addr
=
httpsAddr
if
BConfig
.
Listen
.
HTTPSEnable
{
if
BConfig
.
Listen
.
EnableHTTPS
{
go
func
()
{
time
.
Sleep
(
20
*
time
.
Microsecond
)
if
BConfig
.
Listen
.
HTTPSPort
!=
0
{
...
...
@@ -117,7 +117,7 @@ func (app *App) Run() {
}
}()
}
if
BConfig
.
Listen
.
HTTPEnable
{
if
BConfig
.
Listen
.
EnableHTTP
{
go
func
()
{
server
:=
grace
.
NewServer
(
addr
,
app
.
Handlers
)
server
.
Server
.
ReadTimeout
=
app
.
Server
.
ReadTimeout
...
...
@@ -138,7 +138,7 @@ func (app *App) Run() {
// run normal mode
app
.
Server
.
Addr
=
addr
if
BConfig
.
Listen
.
HTTPSEnable
{
if
BConfig
.
Listen
.
EnableHTTPS
{
go
func
()
{
time
.
Sleep
(
20
*
time
.
Microsecond
)
if
BConfig
.
Listen
.
HTTPSPort
!=
0
{
...
...
@@ -152,7 +152,7 @@ func (app *App) Run() {
}
}()
}
if
BConfig
.
Listen
.
HTTPEnable
{
if
BConfig
.
Listen
.
EnableHTTP
{
go
func
()
{
app
.
Server
.
Addr
=
addr
BeeLogger
.
Info
(
"http server Running on %s"
,
app
.
Server
.
Addr
)
...
...
config.go
View file @
6660720c
...
...
@@ -44,15 +44,15 @@ type Listen struct {
Graceful
bool
// Graceful means use graceful module to start the server
ServerTimeOut
int64
ListenTCP4
bool
HTTPEnable
bool
EnableHTTP
bool
HTTPAddr
string
HTTPPort
int
HTTPSEnable
bool
EnableHTTPS
bool
HTTPSAddr
string
HTTPSPort
int
HTTPSCertFile
string
HTTPSKeyFile
string
AdminEnable
bool
EnableAdmin
bool
AdminAddr
string
AdminPort
int
EnableFcgi
bool
...
...
@@ -123,15 +123,15 @@ func init() {
Graceful
:
false
,
ServerTimeOut
:
0
,
ListenTCP4
:
false
,
HTTPEnable
:
true
,
EnableHTTP
:
true
,
HTTPAddr
:
""
,
HTTPPort
:
8080
,
HTTPSEnable
:
false
,
EnableHTTPS
:
false
,
HTTPSAddr
:
""
,
HTTPSPort
:
10443
,
HTTPSCertFile
:
""
,
HTTPSKeyFile
:
""
,
AdminEnable
:
false
,
EnableAdmin
:
false
,
AdminAddr
:
""
,
AdminPort
:
8088
,
EnableFcgi
:
false
,
...
...
@@ -196,7 +196,7 @@ func ParseConfig() (err error) {
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
(
"
Beego
ServerName"
,
BConfig
.
ServerName
)
BConfig
.
ServerName
=
AppConfig
.
DefaultString
(
"ServerName"
,
BConfig
.
ServerName
)
BConfig
.
EnableGzip
=
AppConfig
.
DefaultBool
(
"EnableGzip"
,
BConfig
.
EnableGzip
)
BConfig
.
EnableErrorsShow
=
AppConfig
.
DefaultBool
(
"EnableErrorsShow"
,
BConfig
.
EnableErrorsShow
)
BConfig
.
CopyRequestBody
=
AppConfig
.
DefaultBool
(
"CopyRequestBody"
,
BConfig
.
CopyRequestBody
)
...
...
@@ -205,18 +205,18 @@ func ParseConfig() (err error) {
BConfig
.
Listen
.
HTTPAddr
=
AppConfig
.
String
(
"HTTPAddr"
)
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
.
EnableHTTP
=
AppConfig
.
DefaultBool
(
"EnableHTTP"
,
BConfig
.
Listen
.
EnableHTTP
)
BConfig
.
Listen
.
EnableHTTPS
=
AppConfig
.
DefaultBool
(
"EnableHTTPS"
,
BConfig
.
Listen
.
EnableHTTPS
)
BConfig
.
Listen
.
HTTPSAddr
=
AppConfig
.
DefaultString
(
"HTTPSAddr"
,
BConfig
.
Listen
.
HTTPSAddr
)
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
(
"Admin
HTTP
Addr"
,
BConfig
.
Listen
.
AdminAddr
)
BConfig
.
Listen
.
AdminPort
=
AppConfig
.
DefaultInt
(
"Admin
HTTP
Port"
,
BConfig
.
Listen
.
AdminPort
)
BConfig
.
Listen
.
HTTPSCertFile
=
AppConfig
.
DefaultString
(
"HTTP
S
CertFile"
,
BConfig
.
Listen
.
HTTPSCertFile
)
BConfig
.
Listen
.
HTTPSKeyFile
=
AppConfig
.
DefaultString
(
"HTTP
S
KeyFile"
,
BConfig
.
Listen
.
HTTPSKeyFile
)
BConfig
.
Listen
.
EnableAdmin
=
AppConfig
.
DefaultBool
(
"EnableAdmin"
,
BConfig
.
Listen
.
EnableAdmin
)
BConfig
.
Listen
.
AdminAddr
=
AppConfig
.
DefaultString
(
"AdminAddr"
,
BConfig
.
Listen
.
AdminAddr
)
BConfig
.
Listen
.
AdminPort
=
AppConfig
.
DefaultInt
(
"AdminPort"
,
BConfig
.
Listen
.
AdminPort
)
BConfig
.
Listen
.
EnableFcgi
=
AppConfig
.
DefaultBool
(
"EnableFcgi"
,
BConfig
.
Listen
.
EnableFcgi
)
BConfig
.
Listen
.
EnableStdIo
=
AppConfig
.
DefaultBool
(
"EnableStdIo"
,
BConfig
.
Listen
.
EnableStdIo
)
BConfig
.
Listen
.
ServerTimeOut
=
AppConfig
.
DefaultInt64
(
"
HTTP
ServerTimeOut"
,
BConfig
.
Listen
.
ServerTimeOut
)
BConfig
.
Listen
.
ServerTimeOut
=
AppConfig
.
DefaultInt64
(
"ServerTimeOut"
,
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
)
...
...
hooks.go
View file @
6660720c
...
...
@@ -48,7 +48,7 @@ func registerSession() error {
"cookieName"
:
BConfig
.
WebConfig
.
Session
.
SessionName
,
"gclifetime"
:
BConfig
.
WebConfig
.
Session
.
SessionGCMaxLifetime
,
"providerConfig"
:
filepath
.
ToSlash
(
BConfig
.
WebConfig
.
Session
.
SessionProviderConfig
),
"secure"
:
BConfig
.
Listen
.
HTTPSEnable
,
"secure"
:
BConfig
.
Listen
.
EnableHTTPS
,
"enableSetCookie"
:
BConfig
.
WebConfig
.
Session
.
SessionAutoSetCookie
,
"domain"
:
BConfig
.
WebConfig
.
Session
.
SessionDomain
,
"cookieLifeTime"
:
BConfig
.
WebConfig
.
Session
.
SessionCookieLifeTime
,
...
...
@@ -88,7 +88,7 @@ func registerDocs() error {
}
func
registerAdmin
()
error
{
if
BConfig
.
Listen
.
AdminEnable
{
if
BConfig
.
Listen
.
EnableAdmin
{
go
beeAdminApp
.
Run
()
}
return
nil
...
...
router.go
View file @
6660720c
...
...
@@ -609,7 +609,7 @@ func (p *ControllerRegister) ServeHTTP(rw http.ResponseWriter, r *http.Request)
defer
p
.
pool
.
Put
(
context
)
defer
p
.
recoverPanic
(
context
)
context
.
Output
.
EnableGzip
=
BConfig
.
EnableGzip
context
.
Output
.
EnableGzip
=
BConfig
.
EnableGzip
if
BConfig
.
RunMode
==
DEV
{
context
.
Output
.
Header
(
"Server"
,
BConfig
.
ServerName
)
...
...
@@ -800,7 +800,7 @@ func (p *ControllerRegister) ServeHTTP(rw http.ResponseWriter, r *http.Request)
Admin
:
timeDur
:=
time
.
Since
(
startTime
)
//admin module record QPS
if
BConfig
.
Listen
.
AdminEnable
{
if
BConfig
.
Listen
.
EnableAdmin
{
if
FilterMonitorFunc
(
r
.
Method
,
r
.
URL
.
Path
,
timeDur
)
{
if
runRouter
!=
nil
{
go
toolbox
.
StatisticsMap
.
AddStatistics
(
r
.
Method
,
r
.
URL
.
Path
,
runRouter
.
Name
(),
timeDur
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment