chore: Clean up adapt test line endings (#4660)

Lots of the files were using CRLF instead of LF. Mostly my fault cause sometimes I make the files on Windows and VSCode for some reason kept making them with the wrong line endings. Sigh.

Since .txt files typically default to spaces for indentation, I'm also adding an .editorconfig to ensure they use tabs instead
This commit is contained in:
Francis Lavoie 2022-03-25 00:48:45 -04:00 committed by GitHub
parent b8dbecb841
commit 4b75f3e2f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 546 additions and 541 deletions

5
.editorconfig Normal file
View file

@ -0,0 +1,5 @@
[*]
end_of_line = lf
[caddytest/integration/caddyfile_adapt/*.txt]
indent_style = tab

View file

@ -1,32 +1,32 @@
:80 :80
file_server { file_server {
pass_thru pass_thru
} }
---------- ----------
{ {
"apps": { "apps": {
"http": { "http": {
"servers": { "servers": {
"srv0": { "srv0": {
"listen": [ "listen": [
":80" ":80"
], ],
"routes": [ "routes": [
{ {
"handle": [ "handle": [
{ {
"handler": "file_server", "handler": "file_server",
"hide": [ "hide": [
"./Caddyfile" "./Caddyfile"
], ],
"pass_thru": true "pass_thru": true
} }
] ]
} }
] ]
} }
} }
} }
} }
} }

View file

@ -1,145 +1,145 @@
:8881 { :8881 {
php_fastcgi app:9000 { php_fastcgi app:9000 {
env FOO bar env FOO bar
@error status 4xx @error status 4xx
handle_response @error { handle_response @error {
root * /errors root * /errors
rewrite * /{http.reverse_proxy.status_code}.html rewrite * /{http.reverse_proxy.status_code}.html
file_server file_server
} }
} }
} }
---------- ----------
{ {
"apps": { "apps": {
"http": { "http": {
"servers": { "servers": {
"srv0": { "srv0": {
"listen": [ "listen": [
":8881" ":8881"
], ],
"routes": [ "routes": [
{ {
"match": [ "match": [
{ {
"file": { "file": {
"try_files": [ "try_files": [
"{http.request.uri.path}/index.php" "{http.request.uri.path}/index.php"
] ]
}, },
"not": [ "not": [
{ {
"path": [ "path": [
"*/" "*/"
] ]
} }
] ]
} }
], ],
"handle": [ "handle": [
{ {
"handler": "static_response", "handler": "static_response",
"headers": { "headers": {
"Location": [ "Location": [
"{http.request.uri.path}/" "{http.request.uri.path}/"
] ]
}, },
"status_code": 308 "status_code": 308
} }
] ]
}, },
{ {
"match": [ "match": [
{ {
"file": { "file": {
"try_files": [ "try_files": [
"{http.request.uri.path}", "{http.request.uri.path}",
"{http.request.uri.path}/index.php", "{http.request.uri.path}/index.php",
"index.php" "index.php"
], ],
"split_path": [ "split_path": [
".php" ".php"
] ]
} }
} }
], ],
"handle": [ "handle": [
{ {
"handler": "rewrite", "handler": "rewrite",
"uri": "{http.matchers.file.relative}" "uri": "{http.matchers.file.relative}"
} }
] ]
}, },
{ {
"match": [ "match": [
{ {
"path": [ "path": [
"*.php" "*.php"
] ]
} }
], ],
"handle": [ "handle": [
{ {
"handle_response": [ "handle_response": [
{ {
"match": { "match": {
"status_code": [ "status_code": [
4 4
] ]
}, },
"routes": [ "routes": [
{ {
"handle": [ "handle": [
{ {
"handler": "vars", "handler": "vars",
"root": "/errors" "root": "/errors"
} }
] ]
}, },
{ {
"group": "group0", "group": "group0",
"handle": [ "handle": [
{ {
"handler": "rewrite", "handler": "rewrite",
"uri": "/{http.reverse_proxy.status_code}.html" "uri": "/{http.reverse_proxy.status_code}.html"
} }
] ]
}, },
{ {
"handle": [ "handle": [
{ {
"handler": "file_server", "handler": "file_server",
"hide": [ "hide": [
"./Caddyfile" "./Caddyfile"
] ]
} }
] ]
} }
] ]
} }
], ],
"handler": "reverse_proxy", "handler": "reverse_proxy",
"transport": { "transport": {
"env": { "env": {
"FOO": "bar" "FOO": "bar"
}, },
"protocol": "fastcgi", "protocol": "fastcgi",
"split_path": [ "split_path": [
".php" ".php"
] ]
}, },
"upstreams": [ "upstreams": [
{ {
"dial": "app:9000" "dial": "app:9000"
} }
] ]
} }
] ]
} }
] ]
} }
} }
} }
} }
} }

View file

@ -1,124 +1,124 @@
:8884 :8884
php_fastcgi localhost:9000 { php_fastcgi localhost:9000 {
# some php_fastcgi-specific subdirectives # some php_fastcgi-specific subdirectives
split .php .php5 split .php .php5
env VAR1 value1 env VAR1 value1
env VAR2 value2 env VAR2 value2
root /var/www root /var/www
try_files {path} {path}/index.php =404 try_files {path} {path}/index.php =404
dial_timeout 3s dial_timeout 3s
read_timeout 10s read_timeout 10s
write_timeout 20s write_timeout 20s
# passed through to reverse_proxy (directive order doesn't matter!) # passed through to reverse_proxy (directive order doesn't matter!)
lb_policy random lb_policy random
} }
---------- ----------
{ {
"apps": { "apps": {
"http": { "http": {
"servers": { "servers": {
"srv0": { "srv0": {
"listen": [ "listen": [
":8884" ":8884"
], ],
"routes": [ "routes": [
{ {
"match": [ "match": [
{ {
"file": { "file": {
"try_files": [ "try_files": [
"{http.request.uri.path}/index.php" "{http.request.uri.path}/index.php"
] ]
}, },
"not": [ "not": [
{ {
"path": [ "path": [
"*/" "*/"
] ]
} }
] ]
} }
], ],
"handle": [ "handle": [
{ {
"handler": "static_response", "handler": "static_response",
"headers": { "headers": {
"Location": [ "Location": [
"{http.request.uri.path}/" "{http.request.uri.path}/"
] ]
}, },
"status_code": 308 "status_code": 308
} }
] ]
}, },
{ {
"match": [ "match": [
{ {
"file": { "file": {
"try_files": [ "try_files": [
"{http.request.uri.path}", "{http.request.uri.path}",
"{http.request.uri.path}/index.php", "{http.request.uri.path}/index.php",
"=404" "=404"
], ],
"split_path": [ "split_path": [
".php", ".php",
".php5" ".php5"
] ]
} }
} }
], ],
"handle": [ "handle": [
{ {
"handler": "rewrite", "handler": "rewrite",
"uri": "{http.matchers.file.relative}" "uri": "{http.matchers.file.relative}"
} }
] ]
}, },
{ {
"match": [ "match": [
{ {
"path": [ "path": [
"*.php", "*.php",
"*.php5" "*.php5"
] ]
} }
], ],
"handle": [ "handle": [
{ {
"handler": "reverse_proxy", "handler": "reverse_proxy",
"load_balancing": { "load_balancing": {
"selection_policy": { "selection_policy": {
"policy": "random" "policy": "random"
} }
}, },
"transport": { "transport": {
"dial_timeout": 3000000000, "dial_timeout": 3000000000,
"env": { "env": {
"VAR1": "value1", "VAR1": "value1",
"VAR2": "value2" "VAR2": "value2"
}, },
"protocol": "fastcgi", "protocol": "fastcgi",
"read_timeout": 10000000000, "read_timeout": 10000000000,
"root": "/var/www", "root": "/var/www",
"split_path": [ "split_path": [
".php", ".php",
".php5" ".php5"
], ],
"write_timeout": 20000000000 "write_timeout": 20000000000
}, },
"upstreams": [ "upstreams": [
{ {
"dial": "localhost:9000" "dial": "localhost:9000"
} }
] ]
} }
] ]
} }
] ]
} }
} }
} }
} }
} }

View file

@ -1,56 +1,56 @@
:8884 :8884
reverse_proxy 127.0.0.1:65535 { reverse_proxy 127.0.0.1:65535 {
trusted_proxies 127.0.0.1 trusted_proxies 127.0.0.1
} }
reverse_proxy 127.0.0.1:65535 { reverse_proxy 127.0.0.1:65535 {
trusted_proxies private_ranges trusted_proxies private_ranges
} }
---------- ----------
{ {
"apps": { "apps": {
"http": { "http": {
"servers": { "servers": {
"srv0": { "srv0": {
"listen": [ "listen": [
":8884" ":8884"
], ],
"routes": [ "routes": [
{ {
"handle": [ "handle": [
{ {
"handler": "reverse_proxy", "handler": "reverse_proxy",
"trusted_proxies": [ "trusted_proxies": [
"127.0.0.1" "127.0.0.1"
], ],
"upstreams": [ "upstreams": [
{ {
"dial": "127.0.0.1:65535" "dial": "127.0.0.1:65535"
} }
] ]
}, },
{ {
"handler": "reverse_proxy", "handler": "reverse_proxy",
"trusted_proxies": [ "trusted_proxies": [
"192.168.0.0/16", "192.168.0.0/16",
"172.16.0.0/12", "172.16.0.0/12",
"10.0.0.0/8", "10.0.0.0/8",
"127.0.0.1/8", "127.0.0.1/8",
"fd00::/8", "fd00::/8",
"::1" "::1"
], ],
"upstreams": [ "upstreams": [
{ {
"dial": "127.0.0.1:65535" "dial": "127.0.0.1:65535"
} }
] ]
} }
] ]
} }
] ]
} }
} }
} }
} }
} }

View file

@ -1,133 +1,133 @@
*.example.com { *.example.com {
@foo host foo.example.com @foo host foo.example.com
handle @foo { handle @foo {
handle_path /strip* { handle_path /strip* {
respond "this should be first" respond "this should be first"
} }
handle { handle {
respond "this should be second" respond "this should be second"
} }
} }
handle { handle {
respond "this should be last" respond "this should be last"
} }
} }
---------- ----------
{ {
"apps": { "apps": {
"http": { "http": {
"servers": { "servers": {
"srv0": { "srv0": {
"listen": [ "listen": [
":443" ":443"
], ],
"routes": [ "routes": [
{ {
"match": [ "match": [
{ {
"host": [ "host": [
"*.example.com" "*.example.com"
] ]
} }
], ],
"handle": [ "handle": [
{ {
"handler": "subroute", "handler": "subroute",
"routes": [ "routes": [
{ {
"group": "group5", "group": "group5",
"handle": [ "handle": [
{ {
"handler": "subroute", "handler": "subroute",
"routes": [ "routes": [
{ {
"group": "group2", "group": "group2",
"handle": [ "handle": [
{ {
"handler": "subroute", "handler": "subroute",
"routes": [ "routes": [
{ {
"handle": [ "handle": [
{ {
"handler": "rewrite", "handler": "rewrite",
"strip_path_prefix": "/strip" "strip_path_prefix": "/strip"
} }
] ]
}, },
{ {
"handle": [ "handle": [
{ {
"body": "this should be first", "body": "this should be first",
"handler": "static_response" "handler": "static_response"
} }
] ]
} }
] ]
} }
], ],
"match": [ "match": [
{ {
"path": [ "path": [
"/strip*" "/strip*"
] ]
} }
] ]
}, },
{ {
"group": "group2", "group": "group2",
"handle": [ "handle": [
{ {
"handler": "subroute", "handler": "subroute",
"routes": [ "routes": [
{ {
"handle": [ "handle": [
{ {
"body": "this should be second", "body": "this should be second",
"handler": "static_response" "handler": "static_response"
} }
] ]
} }
] ]
} }
] ]
} }
] ]
} }
], ],
"match": [ "match": [
{ {
"host": [ "host": [
"foo.example.com" "foo.example.com"
] ]
} }
] ]
}, },
{ {
"group": "group5", "group": "group5",
"handle": [ "handle": [
{ {
"handler": "subroute", "handler": "subroute",
"routes": [ "routes": [
{ {
"handle": [ "handle": [
{ {
"body": "this should be last", "body": "this should be last",
"handler": "static_response" "handler": "static_response"
} }
] ]
} }
] ]
} }
] ]
} }
] ]
} }
], ],
"terminal": true "terminal": true
} }
] ]
} }
} }
} }
} }
} }

View file

@ -1,54 +1,54 @@
a.example.com { a.example.com {
tls { tls {
issuer internal { issuer internal {
ca foo ca foo
lifetime 24h lifetime 24h
sign_with_root sign_with_root
} }
} }
} }
---------- ----------
{ {
"apps": { "apps": {
"http": { "http": {
"servers": { "servers": {
"srv0": { "srv0": {
"listen": [ "listen": [
":443" ":443"
], ],
"routes": [ "routes": [
{ {
"match": [ "match": [
{ {
"host": [ "host": [
"a.example.com" "a.example.com"
] ]
} }
], ],
"terminal": true "terminal": true
} }
] ]
} }
} }
}, },
"tls": { "tls": {
"automation": { "automation": {
"policies": [ "policies": [
{ {
"subjects": [ "subjects": [
"a.example.com" "a.example.com"
], ],
"issuers": [ "issuers": [
{ {
"ca": "foo", "ca": "foo",
"lifetime": 86400000000000, "lifetime": 86400000000000,
"module": "internal", "module": "internal",
"sign_with_root": true "sign_with_root": true
} }
] ]
} }
] ]
} }
} }
} }
} }