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
4f829af7
Commit
4f829af7
authored
Dec 09, 2015
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gofmt the config default
parent
9f2a2507
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
151 deletions
+40
-151
config.go
config.go
+40
-151
No files found.
config.go
View file @
4f829af7
...
@@ -194,135 +194,47 @@ func ParseConfig() (err error) {
...
@@ -194,135 +194,47 @@ func ParseConfig() (err error) {
BConfig
.
RunMode
=
runmode
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"
)
BConfig
.
Listen
.
HTTPAddr
=
AppConfig
.
String
(
"HTTPAddr"
)
BConfig
.
Listen
.
HTTPPort
=
AppConfig
.
DefaultInt
(
"HTTPPort"
,
BConfig
.
Listen
.
HTTPPort
)
if
v
,
err
:=
AppConfig
.
Int
(
"HTTPPort"
);
err
==
nil
{
BConfig
.
Listen
.
ListenTCP4
=
AppConfig
.
DefaultBool
(
"ListenTCP4"
,
BConfig
.
Listen
.
ListenTCP4
)
BConfig
.
Listen
.
HTTPPort
=
v
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
)
if
v
,
err
:=
AppConfig
.
Bool
(
"ListenTCP4"
);
err
==
nil
{
BConfig
.
Listen
.
HTTPSCertFile
=
AppConfig
.
DefaultString
(
"HTTPCertFile"
,
BConfig
.
Listen
.
HTTPSCertFile
)
BConfig
.
Listen
.
ListenTCP4
=
v
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
)
if
v
,
err
:=
AppConfig
.
Bool
(
"EnableHTTPListen"
);
err
==
nil
{
BConfig
.
Listen
.
AdminPort
=
AppConfig
.
DefaultInt
(
"AdminHTTPPort"
,
BConfig
.
Listen
.
AdminPort
)
BConfig
.
Listen
.
HTTPEnable
=
v
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
)
if
maxmemory
,
err
:=
AppConfig
.
Int64
(
"MaxMemory"
);
err
==
nil
{
BConfig
.
WebConfig
.
ViewsPath
=
AppConfig
.
DefaultString
(
"ViewsPath"
,
BConfig
.
WebConfig
.
ViewsPath
)
BConfig
.
MaxMemory
=
maxmemory
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
)
if
appname
:=
AppConfig
.
String
(
"AppName"
);
appname
!=
""
{
BConfig
.
WebConfig
.
XSRFExpire
=
AppConfig
.
DefaultInt
(
"XSRFExpire"
,
BConfig
.
WebConfig
.
XSRFExpire
)
BConfig
.
AppName
=
appname
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
)
if
autorender
,
err
:=
AppConfig
.
Bool
(
"AutoRender"
);
err
==
nil
{
BConfig
.
WebConfig
.
Session
.
SessionProvider
=
AppConfig
.
DefaultString
(
"SessionProvider"
,
BConfig
.
WebConfig
.
Session
.
SessionProvider
)
BConfig
.
WebConfig
.
AutoRender
=
autorender
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
)
if
autorecover
,
err
:=
AppConfig
.
Bool
(
"RecoverPanic"
);
err
==
nil
{
BConfig
.
WebConfig
.
Session
.
SessionCookieLifeTime
=
AppConfig
.
DefaultInt
(
"SessionCookieLifeTime"
,
BConfig
.
WebConfig
.
Session
.
SessionCookieLifeTime
)
BConfig
.
RecoverPanic
=
autorecover
}
BConfig
.
WebConfig
.
FlashName
=
AppConfig
.
DefaultString
(
"FlashName"
,
BConfig
.
WebConfig
.
FlashName
)
BConfig
.
WebConfig
.
FlashSeperator
=
AppConfig
.
DefaultString
(
"FlashSeperator"
,
BConfig
.
WebConfig
.
FlashSeperator
)
if
views
:=
AppConfig
.
String
(
"ViewsPath"
);
views
!=
""
{
BConfig
.
WebConfig
.
ViewsPath
=
views
BConfig
.
WebConfig
.
EnableDocs
=
AppConfig
.
DefaultBool
(
"EnableDocs"
,
BConfig
.
WebConfig
.
EnableDocs
)
}
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
}
if
sd
:=
AppConfig
.
String
(
"StaticDir"
);
sd
!=
""
{
if
sd
:=
AppConfig
.
String
(
"StaticDir"
);
sd
!=
""
{
for
k
:=
range
BConfig
.
WebConfig
.
StaticDir
{
for
k
:=
range
BConfig
.
WebConfig
.
StaticDir
{
...
@@ -355,29 +267,6 @@ func ParseConfig() (err error) {
...
@@ -355,29 +267,6 @@ func ParseConfig() (err error) {
BConfig
.
WebConfig
.
StaticExtensionsToGzip
=
fileExts
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
return
nil
}
}
...
...
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