Sites statique #5

Open
sinavir wants to merge 12 commits from static_website into master
2 changed files with 22 additions and 11 deletions
Showing only changes of commit 5f02d633bd - Show all commits

View file

@ -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" ];
};
};

View 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";
}
];
};
}