Browse Source
* caddyfile: Add support for args on imports * caddyfile: Add more import args testsmaster
Francis Lavoie
5 years ago
committed by
GitHub
7 changed files with 168 additions and 8 deletions
@ -0,0 +1 @@ |
|||
{args.0} |
@ -0,0 +1 @@ |
|||
{args.0} {args.1} |
@ -0,0 +1,49 @@ |
|||
example.com |
|||
|
|||
import testdata/import_respond.txt Groot Rocket |
|||
import testdata/import_respond.txt you "the confused man" |
|||
---------- |
|||
{ |
|||
"apps": { |
|||
"http": { |
|||
"servers": { |
|||
"srv0": { |
|||
"listen": [ |
|||
":443" |
|||
], |
|||
"routes": [ |
|||
{ |
|||
"match": [ |
|||
{ |
|||
"host": [ |
|||
"example.com" |
|||
] |
|||
} |
|||
], |
|||
"handle": [ |
|||
{ |
|||
"handler": "subroute", |
|||
"routes": [ |
|||
{ |
|||
"handle": [ |
|||
{ |
|||
"body": "'I am Groot', hears Rocket", |
|||
"handler": "static_response" |
|||
}, |
|||
{ |
|||
"body": "'I am you', hears the confused man", |
|||
"handler": "static_response" |
|||
} |
|||
] |
|||
} |
|||
] |
|||
} |
|||
], |
|||
"terminal": true |
|||
} |
|||
] |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,83 @@ |
|||
(logging) { |
|||
log { |
|||
output file /var/log/caddy/{args.0}.access.log |
|||
} |
|||
} |
|||
|
|||
a.example.com { |
|||
import logging a.example.com |
|||
} |
|||
|
|||
b.example.com { |
|||
import logging b.example.com |
|||
} |
|||
---------- |
|||
{ |
|||
"logging": { |
|||
"logs": { |
|||
"default": { |
|||
"exclude": [ |
|||
"http.log.access.log0", |
|||
"http.log.access.log1" |
|||
] |
|||
}, |
|||
"log0": { |
|||
"writer": { |
|||
"filename": "/var/log/caddy/a.example.com.access.log", |
|||
"output": "file" |
|||
}, |
|||
"include": [ |
|||
"http.log.access.log0" |
|||
] |
|||
}, |
|||
"log1": { |
|||
"writer": { |
|||
"filename": "/var/log/caddy/b.example.com.access.log", |
|||
"output": "file" |
|||
}, |
|||
"include": [ |
|||
"http.log.access.log1" |
|||
] |
|||
} |
|||
} |
|||
}, |
|||
"apps": { |
|||
"http": { |
|||
"servers": { |
|||
"srv0": { |
|||
"listen": [ |
|||
":443" |
|||
], |
|||
"routes": [ |
|||
{ |
|||
"match": [ |
|||
{ |
|||
"host": [ |
|||
"a.example.com" |
|||
] |
|||
} |
|||
], |
|||
"terminal": true |
|||
}, |
|||
{ |
|||
"match": [ |
|||
{ |
|||
"host": [ |
|||
"b.example.com" |
|||
] |
|||
} |
|||
], |
|||
"terminal": true |
|||
} |
|||
], |
|||
"logs": { |
|||
"logger_names": { |
|||
"a.example.com": "log0", |
|||
"b.example.com": "log1" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1 @@ |
|||
respond "'I am {args.0}', hears {args.1}" |
Loading…
Reference in new issue