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
nexedi
caddy
Commits
18e9aa4d
Commit
18e9aa4d
authored
Nov 06, 2015
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pipe and -conf flag together are an error (#315)
parent
cf5aa1be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
+14
-9
caddy/caddy.go
caddy/caddy.go
+1
-9
main.go
main.go
+13
-0
No files found.
caddy/caddy.go
View file @
18e9aa4d
...
...
@@ -282,15 +282,7 @@ func LoadCaddyfile(loader func() (Input, error)) (cdyfile Input, err error) {
cdyfile
=
loadedGob
.
Caddyfile
}
// Otherwise, we first try to get from stdin pipe
if
cdyfile
==
nil
{
cdyfile
,
err
=
CaddyfileFromPipe
(
os
.
Stdin
)
if
err
!=
nil
{
return
nil
,
err
}
}
// No piped input, so try the user's loader instead
// Try user's loader
if
cdyfile
==
nil
&&
loader
!=
nil
{
cdyfile
,
err
=
loader
()
}
...
...
main.go
View file @
18e9aa4d
...
...
@@ -117,6 +117,19 @@ func mustLogFatal(args ...interface{}) {
}
func
loadCaddyfile
()
(
caddy
.
Input
,
error
)
{
// First try stdin pipe
cdyfile
,
err
:=
caddy
.
CaddyfileFromPipe
(
os
.
Stdin
)
if
err
!=
nil
{
return
nil
,
err
}
if
cdyfile
!=
nil
{
// it is an error if -conf is also specified because, which to use?
if
conf
!=
""
{
return
nil
,
errors
.
New
(
"load: can't choose between stdin pipe and -conf flag"
)
}
return
cdyfile
,
err
}
// -conf flag
if
conf
!=
""
{
contents
,
err
:=
ioutil
.
ReadFile
(
conf
)
...
...
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