mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-20 22:52:58 -05:00
use import to handle globbed values for -conf flag (#1973)
This commit is contained in:
parent
c80c34ef45
commit
e9515425e0
1 changed files with 11 additions and 3 deletions
|
@ -170,10 +170,18 @@ func confLoader(serverType string) (caddy.Input, error) {
|
||||||
return caddy.CaddyfileFromPipe(os.Stdin, serverType)
|
return caddy.CaddyfileFromPipe(os.Stdin, serverType)
|
||||||
}
|
}
|
||||||
|
|
||||||
contents, err := ioutil.ReadFile(conf)
|
var contents []byte
|
||||||
if err != nil {
|
if strings.Contains(conf, "*") {
|
||||||
return nil, err
|
// Let caddyfile.doImport logic handle the globbed path
|
||||||
|
contents = []byte("import " + conf)
|
||||||
|
} else {
|
||||||
|
var err error
|
||||||
|
contents, err = ioutil.ReadFile(conf)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return caddy.CaddyfileInput{
|
return caddy.CaddyfileInput{
|
||||||
Contents: contents,
|
Contents: contents,
|
||||||
Filepath: conf,
|
Filepath: conf,
|
||||||
|
|
Loading…
Add table
Reference in a new issue