Add custom domain prefixes and option to disable user registration

This commit is contained in:
thiloho
2024-09-20 15:56:07 +02:00
parent 4300988463
commit 86ab737429
12 changed files with 368 additions and 57 deletions

View File

@@ -75,6 +75,12 @@ in
default = null;
description = "API secrets for the DNS-01 challenge (required for wildcard domains).";
};
disableRegistration = mkOption {
type = types.bool;
default = false;
description = "By default any user can create an account. That behavior can be disabled by using this option.";
};
};
config = mkIf cfg.enable {
@@ -125,7 +131,7 @@ in
};
script = ''
BODY_SIZE_LIMIT=Infinity ORIGIN=https://${cfg.domain} PORT=${toString cfg.webAppPort} ${pkgs.nodejs_22}/bin/node ${cfg.package}/web-app
REGISTRATION_IS_DISABLED=${toString cfg.disableRegistration} BODY_SIZE_LIMIT=Infinity ORIGIN=https://${cfg.domain} PORT=${toString cfg.webAppPort} ${pkgs.nodejs_22}/bin/node ${cfg.package}/web-app
'';
};
@@ -165,10 +171,13 @@ in
"/api/" = {
proxyPass = "http://localhost:${toString cfg.apiPort}/";
extraConfig = ''
default_type application/json;
default_type application/json;
proxy_set_header Connection "";
proxy_http_version 1.1;
allow 127.0.0.1;
'';
};
"/api/rpc/register" = mkIf cfg.disableRegistration {
extraConfig = ''
deny all;
'';
};