summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMike Pulaski <[email protected]>2016-09-05 18:34:32 +0200
committerMike Pulaski <[email protected]>2016-09-05 18:34:32 +0200
commit635714fe383af210f8aa09ba5f1d9aa2bfb69a62 (patch)
tree4f64c2201da4704e94cf62b9070b96865e0937a0
parenta12230419611951692ee0bb5cd407e6e884be2c2 (diff)
downloadcaddy-635714fe383af210f8aa09ba5f1d9aa2bfb69a62.tar.gz
caddy-635714fe383af210f8aa09ba5f1d9aa2bfb69a62.zip
Caddyfiles read from STDIN now have server types associated with them. Fixes #1090.
-rw-r--r--caddy.go7
-rw-r--r--caddy/caddymain/run.go2
2 files changed, 5 insertions, 4 deletions
diff --git a/caddy.go b/caddy.go
index 76ebc0134..415c59cff 100644
--- a/caddy.go
+++ b/caddy.go
@@ -388,7 +388,7 @@ func (i *Instance) Wait() {
// but the Input value will be nil. An error is only returned
// if there was an error reading the pipe, even if the length
// of what was read is 0.
-func CaddyfileFromPipe(f *os.File) (Input, error) {
+func CaddyfileFromPipe(f *os.File, serverType string) (Input, error) {
fi, err := f.Stat()
if err == nil && fi.Mode()&os.ModeCharDevice == 0 {
// Note that a non-nil error is not a problem. Windows
@@ -402,8 +402,9 @@ func CaddyfileFromPipe(f *os.File) (Input, error) {
return nil, err
}
return CaddyfileInput{
- Contents: confBody,
- Filepath: f.Name(),
+ Contents: confBody,
+ Filepath: f.Name(),
+ ServerTypeName: serverType,
}, nil
}
diff --git a/caddy/caddymain/run.go b/caddy/caddymain/run.go
index 13da2471e..1720c58af 100644
--- a/caddy/caddymain/run.go
+++ b/caddy/caddymain/run.go
@@ -136,7 +136,7 @@ func confLoader(serverType string) (caddy.Input, error) {
}
if conf == "stdin" {
- return caddy.CaddyfileFromPipe(os.Stdin)
+ return caddy.CaddyfileFromPipe(os.Stdin, serverType)
}
contents, err := ioutil.ReadFile(conf)