Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
caddy
Commits
ffafb2ec
Commit
ffafb2ec
authored
Jul 14, 2016
by
Pedro Nasser
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:pedronasser/caddy
parents
6bb1e0c6
6f37e9d3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
15 deletions
+13
-15
caddy.go
caddy.go
+1
-2
caddyfile/parse.go
caddyfile/parse.go
+7
-6
caddyfile/parse_test.go
caddyfile/parse_test.go
+5
-7
No files found.
caddy.go
View file @
ffafb2ec
...
...
@@ -22,7 +22,6 @@ import (
"net"
"os"
"os/exec"
"path"
"runtime"
"strconv"
"strings"
...
...
@@ -399,7 +398,7 @@ func startWithListenerFds(cdyfile Input, inst *Instance, restartFds map[string]r
inst
.
caddyfileInput
=
cdyfile
sblocks
,
err
:=
loadServerBlocks
(
stypeName
,
path
.
Base
(
cdyfile
.
Path
()
),
bytes
.
NewReader
(
cdyfile
.
Body
()))
sblocks
,
err
:=
loadServerBlocks
(
stypeName
,
cdyfile
.
Path
(
),
bytes
.
NewReader
(
cdyfile
.
Body
()))
if
err
!=
nil
{
return
err
}
...
...
caddyfile/parse.go
View file @
ffafb2ec
...
...
@@ -212,13 +212,14 @@ func (p *parser) doImport() error {
// make path relative to Caddyfile rather than current working directory (issue #867)
// and then use glob to get list of matching filenames
absFile
,
err
:=
filepath
.
Abs
(
p
.
Dispenser
.
filename
)
if
err
!=
nil
{
return
p
.
Errf
(
"Failed to get absolute path of file: %s"
,
p
.
Dispenser
.
filename
)
}
var
matches
[]
string
relImportPattern
,
err
:=
filepath
.
Rel
(
filepath
.
Dir
(
p
.
Dispenser
.
filename
),
importPattern
)
if
err
==
nil
{
relImportPattern
:=
filepath
.
Join
(
filepath
.
Dir
(
absFile
),
importPattern
)
matches
,
err
=
filepath
.
Glob
(
relImportPattern
)
}
else
{
matches
,
err
=
filepath
.
Glob
(
importPattern
)
}
if
err
!=
nil
{
return
p
.
Errf
(
"Failed to use import pattern %s: %v"
,
importPattern
,
err
)
...
...
caddyfile/parse_test.go
View file @
ffafb2ec
...
...
@@ -187,7 +187,7 @@ func TestParseOneAndImport(t *testing.T) {
{
`localhost
dir1 arg1
import
../
testdata/import_test1.txt`
,
false
,
[]
string
{
import testdata/import_test1.txt`
,
false
,
[]
string
{
"localhost"
,
},
map
[
string
]
int
{
"dir1"
:
2
,
...
...
@@ -195,16 +195,16 @@ func TestParseOneAndImport(t *testing.T) {
"dir3"
:
1
,
}},
{
`import
../
testdata/import_test2.txt`
,
false
,
[]
string
{
{
`import testdata/import_test2.txt`
,
false
,
[]
string
{
"host1"
,
},
map
[
string
]
int
{
"dir1"
:
1
,
"dir2"
:
2
,
}},
{
`import
../testdata/import_test1.txt ../
testdata/import_test2.txt`
,
true
,
[]
string
{},
map
[
string
]
int
{}},
{
`import
testdata/import_test1.txt
testdata/import_test2.txt`
,
true
,
[]
string
{},
map
[
string
]
int
{}},
{
`import
../
testdata/not_found.txt`
,
true
,
[]
string
{},
map
[
string
]
int
{}},
{
`import testdata/not_found.txt`
,
true
,
[]
string
{},
map
[
string
]
int
{}},
{
`""`
,
false
,
[]
string
{},
map
[
string
]
int
{}},
...
...
@@ -394,8 +394,6 @@ func TestEnvironmentReplacement(t *testing.T) {
func
testParser
(
input
string
)
parser
{
buf
:=
strings
.
NewReader
(
input
)
// use relative path to test that import paths are relative to
// the Caddyfile rather than the current working directory (issue #867)
p
:=
parser
{
Dispenser
:
NewDispenser
(
"../Test"
,
buf
)}
p
:=
parser
{
Dispenser
:
NewDispenser
(
"Caddyfile"
,
buf
)}
return
p
}
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