Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
张磊
/
FileStorageBeego
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
420e816b
authored
2013-12-04 23:53:36 +0800
by
Pengfei Xue
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
panic if parse failed
1 parent
fb6312a3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
9 deletions
beego.go
config.go
beego.go
View file @
420e816
...
...
@@ -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 @
420e816
...
...
@@ -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
Styling with
Markdown
is supported
Attach a file
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 post a comment