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:

OptionSets
headersRequest headers, such as Authorization, as an array of names and values
dataThe request body – an array is sent as form fields, a string as it is
agentThe User-Agent header
basicAuthHTTP basic authentication, as user:password
methodThe HTTP method, for a hook that doesn't take POST
timeoutSeconds 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
        ]
    ]
];
To keep the token out of version control as well, read it from a .env file in config.php – see Environment Variables in Kirby Helpers.