Commit 1ea96def authored by Matt Holt's avatar Matt Holt Committed by GitHub

Merge pull request #1091 from mikepulaski/master

Caddyfiles read from STDIN now have server types associated with them.
parents 5f135a27 635714fe
...@@ -388,7 +388,7 @@ func (i *Instance) Wait() { ...@@ -388,7 +388,7 @@ func (i *Instance) Wait() {
// but the Input value will be nil. An error is only returned // but the Input value will be nil. An error is only returned
// if there was an error reading the pipe, even if the length // if there was an error reading the pipe, even if the length
// of what was read is 0. // 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() fi, err := f.Stat()
if err == nil && fi.Mode()&os.ModeCharDevice == 0 { if err == nil && fi.Mode()&os.ModeCharDevice == 0 {
// Note that a non-nil error is not a problem. Windows // Note that a non-nil error is not a problem. Windows
...@@ -404,6 +404,7 @@ func CaddyfileFromPipe(f *os.File) (Input, error) { ...@@ -404,6 +404,7 @@ func CaddyfileFromPipe(f *os.File) (Input, error) {
return CaddyfileInput{ return CaddyfileInput{
Contents: confBody, Contents: confBody,
Filepath: f.Name(), Filepath: f.Name(),
ServerTypeName: serverType,
}, nil }, nil
} }
......
...@@ -136,7 +136,7 @@ func confLoader(serverType string) (caddy.Input, error) { ...@@ -136,7 +136,7 @@ func confLoader(serverType string) (caddy.Input, error) {
} }
if conf == "stdin" { if conf == "stdin" {
return caddy.CaddyfileFromPipe(os.Stdin) return caddy.CaddyfileFromPipe(os.Stdin, serverType)
} }
contents, err := ioutil.ReadFile(conf) 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