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 (
...
@@ -40,6 +40,7 @@ var (
MaxMemory
int64
MaxMemory
int64
EnableGzip
bool
// enable gzip
EnableGzip
bool
// enable gzip
DirectoryIndex
bool
//ebable DirectoryIndex default is false
DirectoryIndex
bool
//ebable DirectoryIndex default is false
EnbaleHotUpdate
bool
//enable HotUpdate default is false
)
)
func
init
()
{
func
init
()
{
...
@@ -93,6 +94,7 @@ func (app *App) Run() {
...
@@ -93,6 +94,7 @@ func (app *App) Run() {
}
}
err
=
fcgi
.
Serve
(
l
,
app
.
Handlers
)
err
=
fcgi
.
Serve
(
l
,
app
.
Handlers
)
}
else
{
}
else
{
if
EnbaleHotUpdate
{
server
:=
&
http
.
Server
{
Handler
:
app
.
Handlers
}
server
:=
&
http
.
Server
{
Handler
:
app
.
Handlers
}
laddr
,
err
:=
net
.
ResolveTCPAddr
(
"tcp"
,
addr
)
laddr
,
err
:=
net
.
ResolveTCPAddr
(
"tcp"
,
addr
)
if
nil
!=
err
{
if
nil
!=
err
{
...
@@ -103,6 +105,10 @@ func (app *App) Run() {
...
@@ -103,6 +105,10 @@ func (app *App) Run() {
err
=
server
.
Serve
(
theStoppable
)
err
=
server
.
Serve
(
theStoppable
)
theStoppable
.
wg
.
Wait
()
theStoppable
.
wg
.
Wait
()
CloseSelf
()
CloseSelf
()
}
else
{
err
=
http
.
ListenAndServe
(
addr
,
app
.
Handlers
)
}
}
}
if
err
!=
nil
{
if
err
!=
nil
{
BeeLogger
.
Fatal
(
"ListenAndServe: "
,
err
)
BeeLogger
.
Fatal
(
"ListenAndServe: "
,
err
)
...
...
config.go
View file @
d627ec01
...
@@ -133,49 +133,52 @@ func ParseConfig() (err error) {
...
@@ -133,49 +133,52 @@ func ParseConfig() (err error) {
if
v
,
err
:=
AppConfig
.
Int
(
"httpport"
);
err
==
nil
{
if
v
,
err
:=
AppConfig
.
Int
(
"httpport"
);
err
==
nil
{
HttpPort
=
v
HttpPort
=
v
}
}
if
v
,
err
:=
AppConfig
.
Int64
(
"maxmemory"
);
err
==
nil
{
if
maxmemory
,
err
:=
AppConfig
.
Int64
(
"maxmemory"
);
err
==
nil
{
MaxMemory
=
v
MaxMemory
=
maxmemory
}
}
AppName
=
AppConfig
.
String
(
"appname"
)
AppName
=
AppConfig
.
String
(
"appname"
)
if
runmode
:=
AppConfig
.
String
(
"runmode"
);
runmode
!=
""
{
if
runmode
:=
AppConfig
.
String
(
"runmode"
);
runmode
!=
""
{
RunMode
=
runmode
RunMode
=
runmode
}
}
if
ar
,
err
:=
AppConfig
.
Bool
(
"autorender"
);
err
==
nil
{
if
a
utorende
r
,
err
:=
AppConfig
.
Bool
(
"autorender"
);
err
==
nil
{
AutoRender
=
ar
AutoRender
=
a
utorende
r
}
}
if
ar
,
err
:=
AppConfig
.
Bool
(
"autorecover"
);
err
==
nil
{
if
a
utorecove
r
,
err
:=
AppConfig
.
Bool
(
"autorecover"
);
err
==
nil
{
RecoverPanic
=
ar
RecoverPanic
=
a
utorecove
r
}
}
if
ar
,
err
:=
AppConfig
.
Bool
(
"pprofon"
);
err
==
nil
{
if
pprofon
,
err
:=
AppConfig
.
Bool
(
"pprofon"
);
err
==
nil
{
PprofOn
=
ar
PprofOn
=
pprofon
}
}
if
views
:=
AppConfig
.
String
(
"viewspath"
);
views
!=
""
{
if
views
:=
AppConfig
.
String
(
"viewspath"
);
views
!=
""
{
ViewsPath
=
views
ViewsPath
=
views
}
}
if
ar
,
err
:=
AppConfig
.
Bool
(
"sessionon"
);
err
==
nil
{
if
sessionon
,
err
:=
AppConfig
.
Bool
(
"sessionon"
);
err
==
nil
{
SessionOn
=
ar
SessionOn
=
sessionon
}
}
if
ar
:=
AppConfig
.
String
(
"sessionprovider"
);
a
r
!=
""
{
if
sessProvider
:=
AppConfig
.
String
(
"sessionprovider"
);
sessProvide
r
!=
""
{
SessionProvider
=
a
r
SessionProvider
=
sessProvide
r
}
}
if
ar
:=
AppConfig
.
String
(
"sessionname"
);
ar
!=
""
{
if
sessName
:=
AppConfig
.
String
(
"sessionname"
);
sessName
!=
""
{
SessionName
=
ar
SessionName
=
sessName
}
}
if
ar
:=
AppConfig
.
String
(
"sessionsavepath"
);
ar
!=
""
{
if
sesssavepath
:=
AppConfig
.
String
(
"sessionsavepath"
);
sesssavepath
!=
""
{
SessionSavePath
=
ar
SessionSavePath
=
sesssavepath
}
}
if
ar
,
err
:=
AppConfig
.
Int
(
"sessiongcmaxlifetime"
);
err
==
nil
&&
ar
!=
0
{
if
sessMaxLifeTime
,
err
:=
AppConfig
.
Int
(
"sessiongcmaxlifetime"
);
err
==
nil
&&
sessMaxLifeTime
!=
0
{
int64val
,
_
:=
strconv
.
ParseInt
(
strconv
.
Itoa
(
ar
),
10
,
64
)
int64val
,
_
:=
strconv
.
ParseInt
(
strconv
.
Itoa
(
sessMaxLifeTime
),
10
,
64
)
SessionGCMaxLifetime
=
int64val
SessionGCMaxLifetime
=
int64val
}
}
if
ar
,
err
:=
AppConfig
.
Bool
(
"usefcgi"
);
err
==
nil
{
if
usefcgi
,
err
:=
AppConfig
.
Bool
(
"usefcgi"
);
err
==
nil
{
UseFcgi
=
ar
UseFcgi
=
usefcgi
}
}
if
ar
,
err
:=
AppConfig
.
Bool
(
"enablegzip"
);
err
==
nil
{
if
enablegzip
,
err
:=
AppConfig
.
Bool
(
"enablegzip"
);
err
==
nil
{
EnableGzip
=
ar
EnableGzip
=
enablegzip
}
}
if
ar
,
err
:=
AppConfig
.
Bool
(
"directoryindex"
);
err
==
nil
{
if
directoryindex
,
err
:=
AppConfig
.
Bool
(
"directoryindex"
);
err
==
nil
{
DirectoryIndex
=
ar
DirectoryIndex
=
directoryindex
}
if
hotupdate
,
err
:=
AppConfig
.
Bool
(
"hotupdate"
);
err
==
nil
{
EnbaleHotUpdate
=
hotupdate
}
}
}
}
return
nil
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