add service-taskchampion verify test

This commit is contained in:
Ingolf Wagner 2024-09-16 06:35:42 +07:00
parent e62d841524
commit c584bb39ce
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B

View file

@ -8,6 +8,24 @@
{
verify.closed.public.ports.taskchampion = [ config.services.taskchampion-sync-server.port ];
verify.localCommands.taskchampion =
let
domain = "http://orbi.private:10222";
curl = lib.getExe pkgs.curl;
grep = lib.getExe pkgs.gnugrep;
grepString = "TaskChampion sync server";
in
''
if ${curl} -s -o /dev/null -w "%{http_code}" ${domain} | ${grep} -q "200"; then
if ${curl} -s ${domain} | ${grep} -q "${grepString}"; then
echo "[ OK ] Die Seite hat Statuscode 200 und enthält den String '${grepString}'."
else
echo "[Fail] Der Statuscode ist 200, aber die Seite enthält den String '${grepString}' nicht."
fi
else
echo "[Fail] Die Seite hat keinen Statuscode 200."
fi
'';
networking.firewall.interfaces.wg0.allowedTCPPorts = [
config.services.taskchampion-sync-server.port