nixos/freshrss: fix startup when authType = "none"

Prior to this patch, FreshRSS fails to load with an initial
`authType = "none"` setting, instead providing an error:
"Error during context user init!"

To fix this, this patch changes the freshrss-config service to
setup the initial `defaultUser` when `authType = "none"`
is configured.
This commit is contained in:
Matt Christ 2024-04-14 09:10:51 -05:00
parent d3644d8d68
commit 90e673b1b8
4 changed files with 24 additions and 4 deletions

View File

@ -268,11 +268,11 @@ in
script = script =
let let
userScriptArgs = ''--user ${cfg.defaultUser} --password "$(cat ${cfg.passwordFile})"''; userScriptArgs = ''--user ${cfg.defaultUser} ${optionalString (cfg.authType == "form") ''--password "$(cat ${cfg.passwordFile})"''}'';
updateUserScript = optionalString (cfg.authType == "form") '' updateUserScript = optionalString (cfg.authType == "form" || cfg.authType == "none") ''
./cli/update-user.php ${userScriptArgs} ./cli/update-user.php ${userScriptArgs}
''; '';
createUserScript = optionalString (cfg.authType == "form") '' createUserScript = optionalString (cfg.authType == "form" || cfg.authType == "none") ''
./cli/create-user.php ${userScriptArgs} ./cli/create-user.php ${userScriptArgs}
''; '';
in in

View File

@ -328,6 +328,7 @@ in {
freshrss-sqlite = handleTest ./freshrss-sqlite.nix {}; freshrss-sqlite = handleTest ./freshrss-sqlite.nix {};
freshrss-pgsql = handleTest ./freshrss-pgsql.nix {}; freshrss-pgsql = handleTest ./freshrss-pgsql.nix {};
freshrss-http-auth = handleTest ./freshrss-http-auth.nix {}; freshrss-http-auth = handleTest ./freshrss-http-auth.nix {};
freshrss-none-auth = handleTest ./freshrss-none-auth.nix {};
frigate = handleTest ./frigate.nix {}; frigate = handleTest ./frigate.nix {};
frp = handleTest ./frp.nix {}; frp = handleTest ./frp.nix {};
frr = handleTest ./frr.nix {}; frr = handleTest ./frr.nix {};

View File

@ -0,0 +1,19 @@
import ./make-test-python.nix ({ lib, pkgs, ... }: {
name = "freshrss";
meta.maintainers = with lib.maintainers; [ mattchrist ];
nodes.machine = { pkgs, ... }: {
services.freshrss = {
enable = true;
baseUrl = "http://localhost";
authType = "none";
};
};
testScript = ''
machine.wait_for_unit("multi-user.target")
machine.wait_for_open_port(80)
response = machine.succeed("curl -vvv -s http://127.0.0.1:80/i/")
assert '<title>Main stream · FreshRSS</title>' in response, "FreshRSS stream page didn't load successfully"
'';
})

View File

@ -17,7 +17,7 @@ stdenvNoCC.mkDerivation rec {
}; };
passthru.tests = { passthru.tests = {
inherit (nixosTests) freshrss-sqlite freshrss-pgsql freshrss-http-auth; inherit (nixosTests) freshrss-sqlite freshrss-pgsql freshrss-http-auth freshrss-none-auth;
}; };
buildInputs = [ php ]; buildInputs = [ php ];