Add ngrok to allow using webhooks with a local development server

This commit is contained in:
Alex P 2021-10-12 12:45:53 +03:00
parent 295ecb91ff
commit c88ce1ff09
4 changed files with 31 additions and 0 deletions

View file

@ -234,6 +234,14 @@ class IncomingWebhookEndpoint {
$url = str_replace( 'http://', 'https://', $url );
$ngrok_host = getenv( 'NGROK_HOST' );
if ( $ngrok_host ) {
$host = wp_parse_url( $url, PHP_URL_HOST );
if ( $host ) {
$url = str_replace( $host, $ngrok_host, $url );
}
}
return $url;
}