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
c2f7f3ef
Commit
c2f7f3ef
authored
Mar 05, 2017
by
astaxie
Committed by
GitHub
Mar 05, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2380 from fugr/config
config:fix handle include other.conf
parents
1e5051e1
3fa7fc6e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
ini.go
config/ini.go
+8
-7
No files found.
config/ini.go
View file @
c2f7f3ef
...
...
@@ -54,10 +54,10 @@ func (ini *IniConfig) parseFile(name string) (*IniConfigContainer, error) {
return
nil
,
err
}
return
ini
.
parseData
(
data
)
return
ini
.
parseData
(
filepath
.
Dir
(
name
),
data
)
}
func
(
ini
*
IniConfig
)
parseData
(
data
[]
byte
)
(
*
IniConfigContainer
,
error
)
{
func
(
ini
*
IniConfig
)
parseData
(
d
ir
string
,
d
ata
[]
byte
)
(
*
IniConfigContainer
,
error
)
{
cfg
:=
&
IniConfigContainer
{
data
:
make
(
map
[
string
]
map
[
string
]
string
),
sectionComment
:
make
(
map
[
string
]
string
),
...
...
@@ -135,10 +135,6 @@ func (ini *IniConfig) parseData(data []byte) (*IniConfigContainer, error) {
otherfile
:=
strings
.
Trim
(
includefiles
[
1
],
"
\"
"
)
if
!
filepath
.
IsAbs
(
otherfile
)
{
dir
,
err
:=
os
.
Getwd
()
if
err
!=
nil
{
return
nil
,
err
}
otherfile
=
filepath
.
Join
(
dir
,
otherfile
)
}
...
...
@@ -187,8 +183,13 @@ func (ini *IniConfig) parseData(data []byte) (*IniConfigContainer, error) {
}
// ParseData parse ini the data
// When include other.conf,other.conf is either absolute directory
// or under beego in default temporary directory(/tmp/beego).
func
(
ini
*
IniConfig
)
ParseData
(
data
[]
byte
)
(
Configer
,
error
)
{
return
ini
.
parseData
(
data
)
dir
:=
filepath
.
Join
(
os
.
TempDir
(),
"beego"
)
os
.
MkdirAll
(
dir
,
os
.
ModePerm
)
return
ini
.
parseData
(
dir
,
data
)
}
// IniConfigContainer A Config represents the ini configuration.
...
...
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