caddyfile: Preprocess env vars in {$THIS} format (#2963)

* transform a caddyfile with environment variables

* support adapt time and runtime variables in the caddyfile

* caddyfile: Pre-process environment variables before parsing

Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
This commit is contained in:
Mark Sargent
2020-01-10 05:40:16 +13:00
committed by Matt Holt
parent 3828a3aaac
commit 7c419d5349
3 changed files with 124 additions and 120 deletions

View File

@ -15,7 +15,6 @@
package caddyfile
import (
"bytes"
"encoding/json"
"fmt"
@ -42,7 +41,7 @@ func (a Adapter) Adapt(body []byte, options map[string]interface{}) ([]byte, []c
filename = "Caddyfile"
}
serverBlocks, err := Parse(filename, bytes.NewReader(body))
serverBlocks, err := Parse(filename, body)
if err != nil {
return nil, nil, err
}