Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
二次元的罪恶王冠
beego
提交
4f829af7
B
beego
项目概览
二次元的罪恶王冠
/
beego
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
beego
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4f829af7
编写于
12月 10, 2015
作者:
A
astaxie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
gofmt the config default
上级
9f2a2507
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
40 addition
and
151 deletion
+40
-151
config.go
config.go
+40
-151
未找到文件。
config.go
浏览文件 @
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
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录