mirror of
https://github.com/caddyserver/caddy.git
synced 2026-08-03 22:33:28 +00:00
caddytest: Update Caddyfile tests for formatting, HTTP-only blocks
Previous commit improved the Caddyfile adapter so it doesn't unnecessarily add names to "skip" in "auto_https" when the server is already HTTP-only. This commit updates the tests to reflect that change, while also fixing the Caddyfile formatting in many of the tests. We also print the line number of the divergence between input and formatted version in Caddyfile adapt warnings - very useful for finding initial formatting problems.
This commit is contained in:
parent
d68cff8eb6
commit
160d199999
18 changed files with 103 additions and 100 deletions
|
|
@ -529,6 +529,9 @@ func cmdAdaptConfig(fl Flags) (int, error) {
|
|||
adaptedConfig = prettyBuf.Bytes()
|
||||
}
|
||||
|
||||
// print result to stdout
|
||||
fmt.Println(string(adaptedConfig))
|
||||
|
||||
// print warnings to stderr
|
||||
for _, warn := range warnings {
|
||||
msg := warn.Message
|
||||
|
|
@ -538,9 +541,6 @@ func cmdAdaptConfig(fl Flags) (int, error) {
|
|||
fmt.Fprintf(os.Stderr, "[WARNING][%s] %s:%d: %s\n", adaptCmdAdapterFlag, warn.File, warn.Line, msg)
|
||||
}
|
||||
|
||||
// print result to stdout
|
||||
fmt.Println(string(adaptedConfig))
|
||||
|
||||
// validate output if requested
|
||||
if adaptCmdValidateFlag {
|
||||
var cfg *caddy.Config
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue