Configuration
Set the deploy hook URL and the request options your server sends with it.
Plugin Options
Both options live under johannschopplich.deploy-trigger in config.php.
deployUrl String
The URL of the deploy hook. Every click sends a POST request to it. Required – there is no default.
site/config/config.php
return [
'johannschopplich.deploy-trigger' => [
'deployUrl' => 'https://api.netlify.com/build_hooks/<hook-id>'
]
];
requestOptions Array
Options for Kirby's Remote class. Defaults to [], a POST without a body. The ones a deploy hook asks for most:
| Option | Sets |
|---|---|
headers | Request headers, such as Authorization, as an array of names and values |
data | The request body – an array is sent as form fields, a string as it is |
agent | The User-Agent header |
basicAuth | HTTP basic authentication, as user:password |
method | The HTTP method, for a hook that doesn't take POST |
timeout | Seconds to wait for the hook's response |
A hook that expects JSON gets the body through json_encode() and a matching Content-Type:
site/config/config.php
return [
'johannschopplich.deploy-trigger' => [
'deployUrl' => 'https://example.com/hooks/deploy',
'requestOptions' => [
'headers' => [
'Authorization' => 'Bearer <token>',
'Content-Type' => 'application/json'
],
'data' => json_encode(['branch' => 'main']),
'timeout' => 30
]
]
];