Debug des webhooks
This commit is contained in:
parent
783f11a57a
commit
5f02d633bd
2 changed files with 22 additions and 11 deletions
|
@ -23,13 +23,8 @@ in
|
|||
description = "The endpoint of the webhooks";
|
||||
};
|
||||
hooks = mkOption {
|
||||
type = types.listOf (types.submodule {
|
||||
options = mkOption {
|
||||
type = json.type;
|
||||
description = "Configuration for this webhook, check <link xlink:href="https://github.com/adnanh/webhook/blob/master/docs/Hook-Definition.md"/> for supported values";
|
||||
};
|
||||
});
|
||||
description = "An list of enabled webhooks";
|
||||
type = json.type;
|
||||
description = "Configuration for this webhook, check <link xlink:href="https://github.com/adnanh/webhook/blob/master/docs/Hook-Definition.md"/> for supported values";
|
||||
};
|
||||
internalPort = mkOption {
|
||||
type = types.int;
|
||||
|
@ -41,18 +36,17 @@ in
|
|||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts."${cfg.hostname}" = {
|
||||
locations."${endpoint}".proxyPass = "http://127.0.0.1:${cfg.internalPort}/hooks";
|
||||
locations."${cfg.endPoint}".proxyPass = "http://127.0.0.1:${toString cfg.internalPort}/hooks";
|
||||
enableACME = if debug then false else true;
|
||||
};
|
||||
};
|
||||
systemd.services.webhook = {
|
||||
enable = true;
|
||||
unitConfig = {
|
||||
Description = "Small server for creating HTTP hooks";
|
||||
Documentation = "https://github.com/adnanh/webhook/";
|
||||
};
|
||||
serviceConfig = {
|
||||
ExecStart = "${cfg.pkg} -ip \"127.0.0.1\" -port \"${cfg.internalPort}\" -verbose -hooks ${json.generate "conf.json" cfg.hooks}";
|
||||
};
|
||||
script = "${cfg.pkg}/bin/webhook -nopanic -ip \"127.0.0.1\" -port \"${toString cfg.internalPort}\" -verbose -hooks ${json.generate "conf.json" cfg.hooks}";
|
||||
wantedBy = [ "mulit-user.target" ];
|
||||
};
|
||||
};
|
||||
|
|
17
hosts/hackens-org/test-webhook.nix
Normal file
17
hosts/hackens-org/test-webhook.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
services.webhook = {
|
||||
enable = true;
|
||||
hostname = "test-webhook.${config.my.subZone}";
|
||||
hooks = [
|
||||
{
|
||||
id = "testhook";
|
||||
execute-command = pkgs.writeScript "echo.sh" ''
|
||||
#!/bin/sh
|
||||
echo "Bonjour"
|
||||
'';
|
||||
response-message = "Test hook sucess";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue