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
12ade02f
authored
2013-12-03 19:26:51 +0800
by
Pengfei Xue
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
panic if parse config failed
1 parent
ec745693
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
18 deletions
beego.go
config.go
beego.go
View file @
12ade02
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"
...
...
@@ -65,17 +66,8 @@ func InsertFilter(pattern string, pos int, filter FilterFunc) *App {
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 @
12ade02
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
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