diff options
author | Florian Brandes <florian.brandes@posteo.de> | 2024-01-11 10:34:37 +0100 |
---|---|---|
committer | Florian Brandes <florian.brandes@posteo.de> | 2024-01-11 11:32:32 +0100 |
commit | bc21d288f4f089af32f5ee306352f5e11c93da64 (patch) | |
tree | 6505686d2237775ee944022b87d4db9aa047a813 /nixos | |
parent | 010a6250db54a2efb74d7db846379eae0878de09 (diff) |
nixos/pgadmin: apply review suggestions
Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/admin/pgadmin.nix | 11 | ||||
-rw-r--r-- | nixos/tests/pgadmin4.nix | 2 |
2 files changed, 6 insertions, 7 deletions
diff --git a/nixos/modules/services/admin/pgadmin.nix b/nixos/modules/services/admin/pgadmin.nix index fb7b65171aad6..09a9b2714e349 100644 --- a/nixos/modules/services/admin/pgadmin.nix +++ b/nixos/modules/services/admin/pgadmin.nix @@ -44,13 +44,13 @@ in initialPasswordFile = mkOption { description = lib.mdDoc '' Initial password file for the pgAdmin account. Minimum length by default is 6. - Please see services.pgadmin.passwordLength. + Please see `services.pgadmin.minimumPasswordLength`. NOTE: Should be string not a store path, to prevent the password from being world readable ''; type = types.path; }; - passwordLength = mkOption { + minimumPasswordLength = mkOption { description = lib.mdDoc "Minimum length of the password"; type = types.int; default = 6; @@ -122,7 +122,7 @@ in services.pgadmin.settings = { DEFAULT_SERVER_PORT = cfg.port; - PASSWORD_LENGTH_MIN = cfg.passwordLength; + PASSWORD_LENGTH_MIN = cfg.minimumPasswordLength; SERVER_MODE = true; } // (optionalAttrs cfg.openFirewall { DEFAULT_SERVER = mkDefault "::"; @@ -151,9 +151,8 @@ in # and presenting a hard to find error message # see https://github.com/NixOS/nixpkgs/issues/270624 PW_LENGTH=$(wc -m < ${escapeShellArg cfg.initialPasswordFile}) - if [ $PW_LENGTH -lt ${toString cfg.passwordLength} ] - then - echo "Password must be at least ${toString cfg.passwordLength} characters long" + if [ $PW_LENGTH -lt ${toString cfg.minimumPasswordLength} ]; then + echo "Password must be at least ${toString cfg.minimumPasswordLength} characters long" exit 1 fi ( diff --git a/nixos/tests/pgadmin4.nix b/nixos/tests/pgadmin4.nix index 873e40d3939a7..407e4592ef5f7 100644 --- a/nixos/tests/pgadmin4.nix +++ b/nixos/tests/pgadmin4.nix @@ -41,7 +41,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: enable = true; initialEmail = "bruh@localhost.de"; initialPasswordFile = pkgs.writeText "pw" "bruh2012!"; - passwordLength = 12; + minimumPasswordLength = 12; }; }; }; |