mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-30 23:53:48 +03: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)
|
||||
}
|
||||
|
||||
contents, err := ioutil.ReadFile(conf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
var contents []byte
|
||||
if strings.Contains(conf, "*") {
|
||||
// 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{
|
||||
Contents: contents,
|
||||
Filepath: conf,
|
||||
|
|
Loading…
Reference in a new issue