Merge pull request #53952 from Ma27/improve-gitea-module
nixos/gitea: minor fixes
This commit is contained in:
commit
95a0e24381
@ -46,6 +46,9 @@ let
|
|||||||
ROOT_PATH = ${cfg.log.rootPath}
|
ROOT_PATH = ${cfg.log.rootPath}
|
||||||
LEVEL = ${cfg.log.level}
|
LEVEL = ${cfg.log.level}
|
||||||
|
|
||||||
|
[service]
|
||||||
|
DISABLE_REGISTRATION = ${boolToString cfg.disableRegistration}
|
||||||
|
|
||||||
${cfg.extraConfig}
|
${cfg.extraConfig}
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
@ -248,6 +251,18 @@ in
|
|||||||
description = "Upper level of template and static files path.";
|
description = "Upper level of template and static files path.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
disableRegistration = mkEnableOption "the registration lock" // {
|
||||||
|
description = ''
|
||||||
|
By default any user can create an account on this <literal>gitea</literal> instance.
|
||||||
|
This can be disabled by using this option.
|
||||||
|
|
||||||
|
<emphasis>Note:</emphasis> please keep in mind that this should be added after the initial
|
||||||
|
deploy unless <link linkend="opt-services.gitea.useWizard">services.gitea.useWizard</link>
|
||||||
|
is <literal>true</literal> as the first registered user will be the administrator if
|
||||||
|
no install wizard is used.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
extraConfig = mkOption {
|
extraConfig = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "";
|
default = "";
|
||||||
@ -263,7 +278,7 @@ in
|
|||||||
description = "gitea";
|
description = "gitea";
|
||||||
after = [ "network.target" ] ++ lib.optional usePostgresql "postgresql.service" ++ lib.optional useMysql "mysql.service";
|
after = [ "network.target" ] ++ lib.optional usePostgresql "postgresql.service" ++ lib.optional useMysql "mysql.service";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
path = [ gitea.bin ];
|
path = [ gitea.bin pkgs.gitAndTools.git ];
|
||||||
|
|
||||||
preStart = let
|
preStart = let
|
||||||
runConfig = "${cfg.stateDir}/custom/conf/app.ini";
|
runConfig = "${cfg.stateDir}/custom/conf/app.ini";
|
||||||
|
@ -64,6 +64,7 @@ with pkgs.lib;
|
|||||||
machine =
|
machine =
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
{ services.gitea.enable = true;
|
{ services.gitea.enable = true;
|
||||||
|
services.gitea.disableRegistration = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
testScript = ''
|
testScript = ''
|
||||||
@ -72,6 +73,7 @@ with pkgs.lib;
|
|||||||
$machine->waitForUnit('gitea.service');
|
$machine->waitForUnit('gitea.service');
|
||||||
$machine->waitForOpenPort('3000');
|
$machine->waitForOpenPort('3000');
|
||||||
$machine->succeed("curl --fail http://localhost:3000/");
|
$machine->succeed("curl --fail http://localhost:3000/");
|
||||||
|
$machine->succeed("curl --fail http://localhost:3000/user/sign_up | grep 'Registration is disabled. Please contact your site administrator.'");
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user