|
12 | 12 | } |
13 | 13 | } |
14 | 14 |
|
15 | | -{{ caddy.address }} { |
| 15 | +# Setup webhooks |
| 16 | +{{ caddy.addresses.webhook }} { |
16 | 17 | {% if caddy.tls_config is defined %} |
17 | 18 | {{ caddy.tls_config }} |
18 | 19 | {% endif %} |
19 | 20 |
|
20 | 21 | root * {{ caddy.site_dir }} |
21 | 22 |
|
22 | | - # Setup a webhook |
23 | | - handle /gh/* { |
24 | | - # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#delivery-headers |
25 | | - @valid_webhook { |
26 | | - method POST |
27 | | - header Content-Type application/json |
28 | | - header User-Agent GitHub-Hookshot/* |
29 | | - header X-GitHub-Event ping |
30 | | - header X-GitHub-Event push |
31 | | - header X-GitHub-Delivery * |
32 | | - header X-Hub-Signature-256 * |
33 | | - } |
| 23 | + # https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#delivery-headers |
| 24 | + @valid_webhook { |
| 25 | + path /gh/* |
| 26 | + method POST |
| 27 | + header Content-Type application/json |
| 28 | + header User-Agent GitHub-Hookshot/* |
| 29 | + header X-GitHub-Event ping |
| 30 | + header X-GitHub-Event push |
| 31 | + header X-GitHub-Delivery * |
| 32 | + header X-Hub-Signature-256 * |
| 33 | + } |
34 | 34 |
|
35 | | - handle @valid_webhook { |
36 | | - reverse_proxy * localhost:1234 { |
37 | | - # Don't leak out internal problems. |
38 | | - @error status 4xx 5xx |
39 | | - handle_response @error { |
40 | | - error 400 |
41 | | - } |
| 35 | + handle @valid_webhook { |
| 36 | + reverse_proxy * localhost:1234 { |
| 37 | + # Don't leak out internal problems. |
| 38 | + @error status 4xx 5xx |
| 39 | + handle_response @error { |
| 40 | + error 400 |
42 | 41 | } |
43 | 42 | } |
| 43 | + } |
44 | 44 |
|
45 | | - handle { |
46 | | - error 400 |
47 | | - } |
| 45 | + handle { |
| 46 | + error 404 |
48 | 47 | } |
| 48 | +} |
| 49 | + |
| 50 | +{{ caddy.addresses.main }} { |
| 51 | +{% if caddy.tls_config is defined %} |
| 52 | + {{ caddy.tls_config }} |
| 53 | +{% endif %} |
| 54 | + |
| 55 | + root * {{ caddy.site_dir }} |
49 | 56 |
|
50 | 57 | {% for site in repos %} |
51 | 58 | import subproject {{ site }} |
|
0 commit comments