diff options
author | Stig <stig@stig.io> | 2023-11-29 13:01:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-29 13:01:07 +0100 |
commit | 9f060c688e1dee8941349874489c96b10802b290 (patch) | |
tree | 06a61ea27b74ab0b20a6caec67dd4eb478bf6016 /nixos | |
parent | c67a44307a994ce6b8a91567c409765861b06134 (diff) | |
parent | eac5dfd20ff4a618b0b62262bdafcd2245f2c7ea (diff) | |
download | nixlib-9f060c688e1dee8941349874489c96b10802b290.tar nixlib-9f060c688e1dee8941349874489c96b10802b290.tar.gz nixlib-9f060c688e1dee8941349874489c96b10802b290.tar.bz2 nixlib-9f060c688e1dee8941349874489c96b10802b290.tar.lz nixlib-9f060c688e1dee8941349874489c96b10802b290.tar.xz nixlib-9f060c688e1dee8941349874489c96b10802b290.tar.zst nixlib-9f060c688e1dee8941349874489c96b10802b290.zip |
Merge pull request #265661 from TomaSajt/lanraragi
lanraragi: 0.8.90 -> 0.9.0
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/web-apps/lanraragi.nix | 13 | ||||
-rw-r--r-- | nixos/tests/lanraragi.nix | 8 |
2 files changed, 6 insertions, 15 deletions
diff --git a/nixos/modules/services/web-apps/lanraragi.nix b/nixos/modules/services/web-apps/lanraragi.nix index f1ab8b8b4eb4..6e452e7a3b35 100644 --- a/nixos/modules/services/web-apps/lanraragi.nix +++ b/nixos/modules/services/web-apps/lanraragi.nix @@ -72,11 +72,10 @@ in "HOME" = "/var/lib/lanraragi"; }; preStart = '' - REDIS_PASS=${lib.optionalString (cfg.redis.passwordFile != null) "$(head -n1 ${cfg.redis.passwordFile})"} cat > lrr.conf <<EOF { redis_address => "127.0.0.1:${toString cfg.redis.port}", - redis_password => "$REDIS_PASS", + redis_password => "${lib.optionalString (cfg.redis.passwordFile != null) ''$(head -n1 ${cfg.redis.passwordFile})''}", redis_database => "0", redis_database_minion => "1", redis_database_config => "2", @@ -84,15 +83,9 @@ in } EOF '' + lib.optionalString (cfg.passwordFile != null) '' - PASS_HASH=$( - PASS=$(head -n1 ${cfg.passwordFile}) ${cfg.package.perlEnv}/bin/perl -I${cfg.package}/share/lanraragi/lib -e \ - 'use LANraragi::Controller::Config; print LANraragi::Controller::Config::make_password_hash($ENV{PASS})' \ - 2>/dev/null - ) - - ${lib.getExe pkgs.redis} -h 127.0.0.1 -p ${toString cfg.redis.port} -a "$REDIS_PASS" <<EOF + ${lib.getExe pkgs.redis} -h 127.0.0.1 -p ${toString cfg.redis.port} ${lib.optionalString (cfg.redis.passwordFile != null) ''-a "$(head -n1 ${cfg.redis.passwordFile})"''}<<EOF SELECT 2 - HSET LRR_CONFIG password $PASS_HASH + HSET LRR_CONFIG password $(${cfg.package}/bin/helpers/lrr-make-password-hash $(head -n1 ${cfg.passwordFile})) EOF ''; }; diff --git a/nixos/tests/lanraragi.nix b/nixos/tests/lanraragi.nix index f513ac9d252b..7a4a1a489bdf 100644 --- a/nixos/tests/lanraragi.nix +++ b/nixos/tests/lanraragi.nix @@ -10,19 +10,17 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: { services.lanraragi = { enable = true; passwordFile = pkgs.writeText "lrr-test-pass" '' - ultra-secure-password + Ultra-secure-p@ssword-"with-spec1al\chars ''; port = 4000; redis = { port = 4001; passwordFile = pkgs.writeText "redis-lrr-test-pass" '' - still-a-very-secure-password + 123-redis-PASS ''; }; }; }; - - }; testScript = '' @@ -34,7 +32,7 @@ import ./make-test-python.nix ({ pkgs, lib, ... }: { machine2.wait_for_unit("lanraragi.service") machine2.wait_until_succeeds("curl -f localhost:4000") - machine2.succeed("[ $(curl -o /dev/null -X post 'http://localhost:4000/login' --data-raw 'password=ultra-secure-password' -w '%{http_code}') -eq 302 ]") + machine2.succeed("[ $(curl -o /dev/null -X post 'http://localhost:4000/login' --data-raw 'password=Ultra-secure-p@ssword-\"with-spec1al\\chars' -w '%{http_code}') -eq 302 ]") ''; }) |