master: Add config to force https for the endpoint

This commit is contained in:
Dionysis Grigoropoulos 2024-05-09 16:52:20 +03:00 committed by mergify[bot]
parent 4de786e7da
commit 21804ebc84
2 changed files with 13 additions and 1 deletions

View file

@ -69,4 +69,8 @@
# forceSSL = true; # forceSSL = true;
# enableACME = true; # enableACME = true;
#}; #};
# Optional: If buildbot is setup to run behind another proxy that does TLS
# termination set this to true to have buildbot use https:// for its endpoint
#useHTTPS = true;
} }

View file

@ -187,6 +187,14 @@ in
example = "https://buildbot-webhooks.numtide.com/"; example = "https://buildbot-webhooks.numtide.com/";
default = config.services.buildbot-master.buildbotUrl; default = config.services.buildbot-master.buildbotUrl;
}; };
useHTTPS = lib.mkOption {
type = lib.types.nullOr lib.types.bool;
default = false;
description = ''
If buildbot is setup behind a reverse proxy other than the configured nginx set this to true
to force the endpoint to use https:// instead of http://.
'';
};
outputsPath = lib.mkOption { outputsPath = lib.mkOption {
type = lib.types.nullOr lib.types.path; type = lib.types.nullOr lib.types.path;
@ -292,7 +300,7 @@ in
buildbotUrl = buildbotUrl =
let let
host = config.services.nginx.virtualHosts.${cfg.domain}; host = config.services.nginx.virtualHosts.${cfg.domain};
hasSSL = host.forceSSL || host.addSSL; hasSSL = host.forceSSL || host.addSSL || cfg.useHTTPS;
in in
"${if hasSSL then "https" else "http"}://${cfg.domain}/"; "${if hasSSL then "https" else "http"}://${cfg.domain}/";
dbUrl = config.services.buildbot-nix.master.dbUrl; dbUrl = config.services.buildbot-nix.master.dbUrl;