Add pretix extraDomains

This commit is contained in:
Jakob Lechner 2023-11-22 14:49:27 +00:00
parent 95090e1a2b
commit 5c4740989e
No known key found for this signature in database
GPG key ID: 996082EFB5906C10
2 changed files with 29 additions and 13 deletions

View file

@ -4,6 +4,10 @@
enable = true;
instanceName = "Weinturm Open Air";
domain = "tickets.weinturm-open-air.de";
extraDomains = [
"tickets.wasted-openair.de"
"oel.wasted-openair.de"
];
enableTls = true;
enableRegistration = false;
passwordReset = true;

View file

@ -66,7 +66,7 @@ let
};
in
{
options.services.pretix = with lib; {
options.services.pretix = with lib; with lib.types; {
enable = mkEnableOption "Enable pretix ticket shop application";
instanceName = mkOption {
type = types.str;
@ -74,7 +74,13 @@ in
};
domain = mkOption {
type = types.str;
description = "The installations domain";
description = "The installations main domain";
example = "pretix.example.net";
};
extraDomains = mkOption {
type = listOf str;
description = "A list of extra domains";
default = [ ];
};
enableTls = mkEnableOption "Whether to use TLS or not";
enableRegistration = mkEnableOption "Enables or disables the registration of new admin users.";
@ -124,17 +130,23 @@ in
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
virtualHosts."${cfg.domain}" = {
enableACME = cfg.enableTls;
forceSSL = cfg.enableTls;
kTLS = cfg.enableTls;
locations."/" = {
proxyPass = "http://${bind.host}:${toString bind.port}";
};
extraConfig = ''
${hstsHeader}
'';
};
virtualHosts = lib.listToAttrs (map
(d: {
name = d;
value = {
enableACME = cfg.enableTls;
forceSSL = cfg.enableTls;
kTLS = cfg.enableTls;
locations."/" = {
proxyPass = "http://${bind.host}:${toString bind.port}";
};
extraConfig = ''
${hstsHeader}
'';
};
})
([ cfg.domain ] ++ cfg.extraDomains)
);
};
services.postgresql = {