mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-30 22:34:15 -05:00
26cc883708
This migrates a feature that was previously reserved for enterprise users, according to #2786. The Starlark integration needs to be updated since this was made before some significant changes in the v2 code base. When functional, it makes it possible to have very dynamic HTTP handlers. This will be a long-term ongoing project. Credit to Danny Navarro
19 lines
No EOL
483 B
JSON
19 lines
No EOL
483 B
JSON
{
|
|
"apps": {
|
|
"http": {
|
|
"servers": {
|
|
"MY_SERVER": {
|
|
"listen": [":3001"],
|
|
"routes": [
|
|
{
|
|
"handle": {
|
|
"handler": "starlark",
|
|
"script": "def setup(r):\n\t# create some middlewares specific to this request\n\ttemplates = loadModule('http.handlers.templates', {'include_root': './includes'})\n\tmidChain = execute([templates])\n\ndef serveHTTP (rw, r):\n\trw.Write('Hello world, from Starlark!')\n"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |