Sites statique #5
1 changed files with 8 additions and 4 deletions
|
@ -5,6 +5,7 @@ let
|
||||||
cfg = config.services.webhook;
|
cfg = config.services.webhook;
|
||||||
debug = config.my.debug;
|
debug = config.my.debug;
|
||||||
in
|
in
|
||||||
|
{
|
||||||
options.services.webhook = {
|
options.services.webhook = {
|
||||||
enable = mkEnableOption "Set up webhooks";
|
enable = mkEnableOption "Set up webhooks";
|
||||||
pkg = mkOption {
|
pkg = mkOption {
|
||||||
|
@ -25,7 +26,7 @@ in
|
||||||
type = types.listOf (types.submodule {
|
type = types.listOf (types.submodule {
|
||||||
options = mkOption {
|
options = mkOption {
|
||||||
type = json.type;
|
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 = "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";
|
description = "An list of enabled webhooks";
|
||||||
|
@ -38,9 +39,11 @@ in
|
||||||
};
|
};
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
enableACME = if debug then false else true;
|
|
||||||
enable = true;
|
enable = true;
|
||||||
virtualHosts."${cfg.hostname}".locations."${endpoint}".proxyPass = "http://127.0.0.1:${cfg.internalPort}/hooks";
|
virtualHosts."${cfg.hostname}" = {
|
||||||
|
locations."${endpoint}".proxyPass = "http://127.0.0.1:${cfg.internalPort}/hooks";
|
||||||
|
enableACME = if debug then false else true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
systemd.services.webhook = {
|
systemd.services.webhook = {
|
||||||
unitConfig = {
|
unitConfig = {
|
||||||
|
@ -51,5 +54,6 @@ in
|
||||||
ExecStart = "${cfg.pkg} -ip \"127.0.0.1\" -port \"${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" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue