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
d627ec01
Commit
d627ec01
authored
Jun 28, 2013
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add config to countol if enable hotupdate
parent
d0bbc67b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
24 deletions
+33
-24
beego.go
beego.go
+6
-0
config.go
config.go
+27
-24
No files found.
beego.go
View file @
d627ec01
...
...
@@ -40,6 +40,7 @@ var (
MaxMemory
int64
EnableGzip
bool
// enable gzip
DirectoryIndex
bool
//ebable DirectoryIndex default is false
EnbaleHotUpdate
bool
//enable HotUpdate default is false
)
func
init
()
{
...
...
@@ -93,6 +94,7 @@ func (app *App) Run() {
}
err
=
fcgi
.
Serve
(
l
,
app
.
Handlers
)
}
else
{
if
EnbaleHotUpdate
{
server
:=
&
http
.
Server
{
Handler
:
app
.
Handlers
}
laddr
,
err
:=
net
.
ResolveTCPAddr
(
"tcp"
,
addr
)
if
nil
!=
err
{
...
...
@@ -103,6 +105,10 @@ func (app *App) Run() {
err
=
server
.
Serve
(
theStoppable
)
theStoppable
.
wg
.
Wait
()
CloseSelf
()
}
else
{
err
=
http
.
ListenAndServe
(
addr
,
app
.
Handlers
)
}
}
if
err
!=
nil
{
BeeLogger
.
Fatal
(
"ListenAndServe: "
,
err
)
...
...
config.go
View file @
d627ec01
...
...
@@ -133,49 +133,52 @@ func ParseConfig() (err error) {
if
v
,
err
:=
AppConfig
.
Int
(
"httpport"
);
err
==
nil
{
HttpPort
=
v
}
if
v
,
err
:=
AppConfig
.
Int64
(
"maxmemory"
);
err
==
nil
{
MaxMemory
=
v
if
maxmemory
,
err
:=
AppConfig
.
Int64
(
"maxmemory"
);
err
==
nil
{
MaxMemory
=
maxmemory
}
AppName
=
AppConfig
.
String
(
"appname"
)
if
runmode
:=
AppConfig
.
String
(
"runmode"
);
runmode
!=
""
{
RunMode
=
runmode
}
if
ar
,
err
:=
AppConfig
.
Bool
(
"autorender"
);
err
==
nil
{
AutoRender
=
ar
if
a
utorende
r
,
err
:=
AppConfig
.
Bool
(
"autorender"
);
err
==
nil
{
AutoRender
=
a
utorende
r
}
if
ar
,
err
:=
AppConfig
.
Bool
(
"autorecover"
);
err
==
nil
{
RecoverPanic
=
ar
if
a
utorecove
r
,
err
:=
AppConfig
.
Bool
(
"autorecover"
);
err
==
nil
{
RecoverPanic
=
a
utorecove
r
}
if
ar
,
err
:=
AppConfig
.
Bool
(
"pprofon"
);
err
==
nil
{
PprofOn
=
ar
if
pprofon
,
err
:=
AppConfig
.
Bool
(
"pprofon"
);
err
==
nil
{
PprofOn
=
pprofon
}
if
views
:=
AppConfig
.
String
(
"viewspath"
);
views
!=
""
{
ViewsPath
=
views
}
if
ar
,
err
:=
AppConfig
.
Bool
(
"sessionon"
);
err
==
nil
{
SessionOn
=
ar
if
sessionon
,
err
:=
AppConfig
.
Bool
(
"sessionon"
);
err
==
nil
{
SessionOn
=
sessionon
}
if
ar
:=
AppConfig
.
String
(
"sessionprovider"
);
a
r
!=
""
{
SessionProvider
=
a
r
if
sessProvider
:=
AppConfig
.
String
(
"sessionprovider"
);
sessProvide
r
!=
""
{
SessionProvider
=
sessProvide
r
}
if
ar
:=
AppConfig
.
String
(
"sessionname"
);
ar
!=
""
{
SessionName
=
ar
if
sessName
:=
AppConfig
.
String
(
"sessionname"
);
sessName
!=
""
{
SessionName
=
sessName
}
if
ar
:=
AppConfig
.
String
(
"sessionsavepath"
);
ar
!=
""
{
SessionSavePath
=
ar
if
sesssavepath
:=
AppConfig
.
String
(
"sessionsavepath"
);
sesssavepath
!=
""
{
SessionSavePath
=
sesssavepath
}
if
ar
,
err
:=
AppConfig
.
Int
(
"sessiongcmaxlifetime"
);
err
==
nil
&&
ar
!=
0
{
int64val
,
_
:=
strconv
.
ParseInt
(
strconv
.
Itoa
(
ar
),
10
,
64
)
if
sessMaxLifeTime
,
err
:=
AppConfig
.
Int
(
"sessiongcmaxlifetime"
);
err
==
nil
&&
sessMaxLifeTime
!=
0
{
int64val
,
_
:=
strconv
.
ParseInt
(
strconv
.
Itoa
(
sessMaxLifeTime
),
10
,
64
)
SessionGCMaxLifetime
=
int64val
}
if
ar
,
err
:=
AppConfig
.
Bool
(
"usefcgi"
);
err
==
nil
{
UseFcgi
=
ar
if
usefcgi
,
err
:=
AppConfig
.
Bool
(
"usefcgi"
);
err
==
nil
{
UseFcgi
=
usefcgi
}
if
ar
,
err
:=
AppConfig
.
Bool
(
"enablegzip"
);
err
==
nil
{
EnableGzip
=
ar
if
enablegzip
,
err
:=
AppConfig
.
Bool
(
"enablegzip"
);
err
==
nil
{
EnableGzip
=
enablegzip
}
if
ar
,
err
:=
AppConfig
.
Bool
(
"directoryindex"
);
err
==
nil
{
DirectoryIndex
=
ar
if
directoryindex
,
err
:=
AppConfig
.
Bool
(
"directoryindex"
);
err
==
nil
{
DirectoryIndex
=
directoryindex
}
if
hotupdate
,
err
:=
AppConfig
.
Bool
(
"hotupdate"
);
err
==
nil
{
EnbaleHotUpdate
=
hotupdate
}
}
return
nil
...
...
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