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
36022016
Commit
36022016
authored
Feb 02, 2016
by
JessonChan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove useless var , name style fixed
parent
5dec3d12
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
24 deletions
+19
-24
config.go
config.go
+19
-24
No files found.
config.go
View file @
36022016
...
...
@@ -15,11 +15,11 @@
package
beego
import
(
"fmt"
"html/template"
"os"
"path/filepath"
"strings"
"fmt"
"github.com/astaxie/beego/config"
"github.com/astaxie/beego/session"
...
...
@@ -111,7 +111,6 @@ var (
// GlobalSessions is the instance for the session manager
GlobalSessions
*
session
.
Manager
workPath
string
// appConfigPath is the path to the config files
appConfigPath
string
// appConfigProvider is the provider for the config, default is ini
...
...
@@ -120,12 +119,8 @@ var (
func
init
()
{
AppPath
,
_
=
filepath
.
Abs
(
filepath
.
Dir
(
os
.
Args
[
0
]))
workPath
,
_
=
os
.
Getwd
()
workPath
,
_
=
filepath
.
Abs
(
workPath
)
if
workPath
!=
AppPath
{
os
.
Chdir
(
AppPath
)
}
os
.
Chdir
(
AppPath
)
BConfig
=
&
Config
{
AppName
:
"beego"
,
...
...
@@ -175,7 +170,7 @@ func init() {
SessionName
:
"beegosessionID"
,
SessionGCMaxLifetime
:
3600
,
SessionProviderConfig
:
""
,
SessionCookieLifeTime
:
0
,
//set cookie default is the brower life
SessionCookieLifeTime
:
0
,
//set cookie default is the brow
s
er life
SessionAutoSetCookie
:
true
,
SessionDomain
:
""
,
},
...
...
@@ -189,7 +184,7 @@ func init() {
appConfigPath
=
filepath
.
Join
(
AppPath
,
"conf"
,
"app.conf"
)
if
!
utils
.
FileExists
(
appConfigPath
)
{
AppConfig
=
&
beegoAppConfig
{
config
.
NewFakeConfig
()}
AppConfig
=
&
beegoAppConfig
{
innerConfig
:
config
.
NewFakeConfig
()}
return
}
...
...
@@ -202,11 +197,11 @@ func parseConfig(appConfigPath string) (err error) {
if
err
!=
nil
{
return
err
}
// set the runmode first
// set the run
mode first
if
envRunMode
:=
os
.
Getenv
(
"BEEGO_RUNMODE"
);
envRunMode
!=
""
{
BConfig
.
RunMode
=
envRunMode
}
else
if
run
mode
:=
AppConfig
.
String
(
"RunMode"
);
runm
ode
!=
""
{
BConfig
.
RunMode
=
run
m
ode
}
else
if
run
Mode
:=
AppConfig
.
String
(
"RunMode"
);
runM
ode
!=
""
{
BConfig
.
RunMode
=
run
M
ode
}
BConfig
.
AppName
=
AppConfig
.
DefaultString
(
"AppName"
,
BConfig
.
AppName
)
...
...
@@ -393,46 +388,46 @@ func (b *beegoAppConfig) Float(key string) (float64, error) {
return
b
.
innerConfig
.
Float
(
key
)
}
func
(
b
*
beegoAppConfig
)
DefaultString
(
key
string
,
default
v
al
string
)
string
{
func
(
b
*
beegoAppConfig
)
DefaultString
(
key
string
,
default
V
al
string
)
string
{
if
v
:=
b
.
String
(
key
);
v
!=
""
{
return
v
}
return
default
v
al
return
default
V
al
}
func
(
b
*
beegoAppConfig
)
DefaultStrings
(
key
string
,
default
v
al
[]
string
)
[]
string
{
func
(
b
*
beegoAppConfig
)
DefaultStrings
(
key
string
,
default
V
al
[]
string
)
[]
string
{
if
v
:=
b
.
Strings
(
key
);
len
(
v
)
!=
0
{
return
v
}
return
default
v
al
return
default
V
al
}
func
(
b
*
beegoAppConfig
)
DefaultInt
(
key
string
,
default
v
al
int
)
int
{
func
(
b
*
beegoAppConfig
)
DefaultInt
(
key
string
,
default
V
al
int
)
int
{
if
v
,
err
:=
b
.
Int
(
key
);
err
==
nil
{
return
v
}
return
default
v
al
return
default
V
al
}
func
(
b
*
beegoAppConfig
)
DefaultInt64
(
key
string
,
default
v
al
int64
)
int64
{
func
(
b
*
beegoAppConfig
)
DefaultInt64
(
key
string
,
default
V
al
int64
)
int64
{
if
v
,
err
:=
b
.
Int64
(
key
);
err
==
nil
{
return
v
}
return
default
v
al
return
default
V
al
}
func
(
b
*
beegoAppConfig
)
DefaultBool
(
key
string
,
default
v
al
bool
)
bool
{
func
(
b
*
beegoAppConfig
)
DefaultBool
(
key
string
,
default
V
al
bool
)
bool
{
if
v
,
err
:=
b
.
Bool
(
key
);
err
==
nil
{
return
v
}
return
default
v
al
return
default
V
al
}
func
(
b
*
beegoAppConfig
)
DefaultFloat
(
key
string
,
default
v
al
float64
)
float64
{
func
(
b
*
beegoAppConfig
)
DefaultFloat
(
key
string
,
default
V
al
float64
)
float64
{
if
v
,
err
:=
b
.
Float
(
key
);
err
==
nil
{
return
v
}
return
default
v
al
return
default
V
al
}
func
(
b
*
beegoAppConfig
)
DIY
(
key
string
)
(
interface
{},
error
)
{
...
...
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