1
0
Fork 0
mirror of https://github.com/NixOS/ofborg synced 2024-10-18 14:56:36 -04:00
ofborg/php
Andreas Rammhold de74c9e88c Fix the php packaging for the latest nixpkgs revision
Nixpkgs has dropped PHP 7.2. Updating to PHP 7.4 should be painless as
our usage of PHP is very limited.
2021-07-07 12:19:54 -07:00
..
web Webhook: create an 'unknown' queue for collecting weird messages 2018-03-05 07:39:35 -05:00
composer-env.nix Fix the php packaging for the latest nixpkgs revision 2021-07-07 12:19:54 -07:00
composer.json Fix the php packaging for the latest nixpkgs revision 2021-07-07 12:19:54 -07:00
composer.lock Fix the php packaging for the latest nixpkgs revision 2021-07-07 12:19:54 -07:00
default.nix Fix the php packaging for the latest nixpkgs revision 2021-07-07 12:19:54 -07:00
php-packages.nix Fix the php packaging for the latest nixpkgs revision 2021-07-07 12:19:54 -07:00
README.md php: add README.md explaining the configuration 2020-10-06 14:05:43 -07:00

Webhook Receiver

This PHP code receives the GitHub webhook, checks them for integrity and publishes messages on rabbitmq.

Configuration

The code expects a config.php in it's parent directory. An example configuration looks like this:

<?php

require_once __DIR__ . '/vendor/autoload.php';
use PhpAmqpLib\Connection\AMQPSSLConnection;
use PhpAmqpLib\Message\AMQPMessage;

function rabbitmq_conn($timeout = 3) {
    $host = 'events.nix.gsc.io';
    $connection = new AMQPSSLConnection(
        $host, 5671,
        'eventsuser, eventspassword, '/',
        array(
            'verify_peer' => true,
            'verify_peer_name' => true,
            'peer_name' => $host,
            'verify_depth' => 10,
            'ca_file' => '/etc/ssl/certs/ca-certificates.crt',
        ), array(
            'connection_timeout' => $timeout,
        )
    );
    return $connection;
}

function gh_secret() {
    return "github webhook secret";
}