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
12ade02f
Commit
12ade02f
authored
Dec 03, 2013
by
Pengfei Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
panic if parse config failed
parent
ec745693
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
20 deletions
+26
-20
beego.go
beego.go
+6
-14
config.go
config.go
+20
-6
No files found.
beego.go
View file @
12ade02f
package
beego
import
(
"github.com/astaxie/beego/middleware"
"github.com/astaxie/beego/session"
"net/http"
"path"
"strings"
"github.com/astaxie/beego/middleware"
"github.com/astaxie/beego/session"
)
const
VERSION
=
"0.9.9"
...
...
@@ -61,21 +62,12 @@ func AddFilter(pattern, action string, filter FilterFunc) *App {
}
func
InsertFilter
(
pattern
string
,
pos
int
,
filter
FilterFunc
)
*
App
{
BeeApp
.
InsertFilter
(
pattern
,
pos
,
filter
)
return
BeeApp
BeeApp
.
InsertFilter
(
pattern
,
pos
,
filter
)
return
BeeApp
}
func
Run
()
{
//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
)
}
}
}
InitConfig
()
if
SessionOn
{
GlobalSessions
,
_
=
session
.
NewManager
(
SessionProvider
,
...
...
config.go
View file @
12ade02f
package
beego
import
(
"github.com/astaxie/beego/config"
"github.com/astaxie/beego/session"
"html/template"
"os"
"path"
"runtime"
"strconv"
"strings"
"github.com/astaxie/beego/config"
"github.com/astaxie/beego/session"
)
var
(
...
...
@@ -58,9 +59,9 @@ var (
AdminHttpPort
int
)
func
init
()
{
func
InitConfig
()
{
// explicit call config.Init
os
.
Chdir
(
path
.
Dir
(
os
.
Args
[
0
]))
BeeApp
=
NewApp
()
AppPath
=
path
.
Dir
(
os
.
Args
[
0
])
StaticDir
=
make
(
map
[
string
]
string
)
TemplateCache
=
make
(
map
[
string
]
*
template
.
Template
)
...
...
@@ -84,7 +85,6 @@ func init() {
MaxMemory
=
1
<<
26
//64MB
EnableGzip
=
false
StaticDir
[
"/static"
]
=
"static"
AppConfigPath
=
path
.
Join
(
AppPath
,
"conf"
,
"app.conf"
)
HttpServerTimeOut
=
0
ErrorsShow
=
true
XSRFKEY
=
"beegoxsrf"
...
...
@@ -95,7 +95,17 @@ func init() {
EnableAdmin
=
true
AdminHttpAddr
=
"localhost"
AdminHttpPort
=
8088
ParseConfig
()
// if AppConfigPath hasn't been set yet,
// use /Path/to/AppPath/conf/app.conf as the default
if
AppConfigPath
==
""
{
AppConfigPath
=
path
.
Join
(
AppPath
,
"conf"
,
"app.conf"
)
}
if
err
:=
ParseConfig
();
err
!=
nil
{
panic
(
err
)
}
runtime
.
GOMAXPROCS
(
runtime
.
NumCPU
())
}
...
...
@@ -259,3 +269,7 @@ func ParseConfig() (err error) {
}
return
nil
}
func
init
()
{
BeeApp
=
NewApp
()
}
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