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";
|
description = "The endpoint of the webhooks";
|
||||||
};
|
};
|
||||||
hooks = mkOption {
|
hooks = mkOption {
|
||||||
type = types.listOf (types.submodule {
|
type = json.type;
|
||||||
options = mkOption {
|
description = "Configuration for this webhook, check <link xlink:href="https://github.com/adnanh/webhook/blob/master/docs/Hook-Definition.md"/> for supported values";
|
||||||
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";
|
|
||||||
};
|
};
|
||||||
internalPort = mkOption {
|
internalPort = mkOption {
|
||||||
type = types.int;
|
type = types.int;
|
||||||
|
@ -41,18 +36,17 @@ in
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
enable = true;
|
enable = true;
|
||||||
virtualHosts."${cfg.hostname}" = {
|
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;
|
enableACME = if debug then false else true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
systemd.services.webhook = {
|
systemd.services.webhook = {
|
||||||
|
enable = true;
|
||||||
unitConfig = {
|
unitConfig = {
|
||||||
Description = "Small server for creating HTTP hooks";
|
Description = "Small server for creating HTTP hooks";
|
||||||
Documentation = "https://github.com/adnanh/webhook/";
|
Documentation = "https://github.com/adnanh/webhook/";
|
||||||
};
|
};
|
||||||
serviceConfig = {
|
script = "${cfg.pkg}/bin/webhook -nopanic -ip \"127.0.0.1\" -port \"${toString cfg.internalPort}\" -verbose -hooks ${json.generate "conf.json" cfg.hooks}";
|
||||||
ExecStart = "${cfg.pkg} -ip \"127.0.0.1\" -port \"${cfg.internalPort}\" -verbose -hooks ${json.generate "conf.json" cfg.hooks}";
|
|
||||||
};
|
|
||||||
wantedBy = [ "mulit-user.target" ];
|
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