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
420e816b
Commit
420e816b
authored
Dec 04, 2013
by
Pengfei Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
panic if parse failed
parent
fb6312a3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
9 deletions
+37
-9
beego.go
beego.go
+3
-4
config.go
config.go
+34
-5
No files found.
beego.go
View file @
420e816b
...
...
@@ -67,13 +67,12 @@ func InsertFilter(pattern string, pos int, filter FilterFunc) *App {
}
func
Run
()
{
//if AppConfigPath not In the conf/app.conf reParse config
//
if AppConfigPath not In the conf/app.conf reParse config
if
AppConfigPath
!=
path
.
Join
(
AppPath
,
"conf"
,
"app.conf"
)
{
err
:=
ParseConfig
()
if
err
!=
nil
{
if
RunMode
==
"dev"
{
Warn
(
err
)
}
// configuration is critical to app, panic here if parse failed
panic
(
err
)
}
}
...
...
config.go
View file @
420e816b
...
...
@@ -59,18 +59,32 @@ var (
)
func
init
()
{
os
.
Chdir
(
path
.
Dir
(
os
.
Args
[
0
]))
// create beeapp
BeeApp
=
NewApp
()
// initialize default configurations
os
.
Chdir
(
path
.
Dir
(
os
.
Args
[
0
]))
AppPath
=
path
.
Dir
(
os
.
Args
[
0
])
StaticDir
=
make
(
map
[
string
]
string
)
StaticDir
[
"/static"
]
=
"static"
TemplateCache
=
make
(
map
[
string
]
*
template
.
Template
)
HttpAddr
=
""
// set this to 0.0.0.0 to make this app available to externally
HttpAddr
=
"127.0.0.1"
HttpPort
=
8080
AppName
=
"beego"
RunMode
=
"dev"
//default runmod
AutoRender
=
true
RecoverPanic
=
true
ViewsPath
=
"views"
SessionOn
=
false
SessionProvider
=
"memory"
SessionName
=
"beegosessionID"
...
...
@@ -79,23 +93,38 @@ func init() {
SessionHashFunc
=
"sha1"
SessionHashKey
=
"beegoserversessionkey"
SessionCookieLifeTime
=
3600
UseFcgi
=
false
MaxMemory
=
1
<<
26
//64MB
EnableGzip
=
false
StaticDir
[
"/static"
]
=
"static"
AppConfigPath
=
path
.
Join
(
AppPath
,
"conf"
,
"app.conf"
)
HttpServerTimeOut
=
0
ErrorsShow
=
true
XSRFKEY
=
"beegoxsrf"
XSRFExpire
=
0
TemplateLeft
=
"{{"
TemplateRight
=
"}}"
BeegoServerName
=
"beegoServer"
EnableAdmin
=
true
AdminHttpAddr
=
"
localhost
"
AdminHttpAddr
=
"
127.0.0.1
"
AdminHttpPort
=
8088
ParseConfig
()
runtime
.
GOMAXPROCS
(
runtime
.
NumCPU
())
err
:=
ParseConfig
()
if
err
!=
nil
&&
!
os
.
IsNotExist
(
err
)
{
// panic unless the err is can not find default configuration file
panic
(
err
)
}
}
func
ParseConfig
()
(
err
error
)
{
...
...
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