Commit 635714fe authored by Mike Pulaski's avatar Mike Pulaski

Caddyfiles read from STDIN now have server types associated with them. Fixes #1090.

parent a1223041
......@@ -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
}
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment