Push notifications: period soon/late reminders, test button
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ce66b857db
commit
bb19bc0aeb
12 changed files with 872 additions and 21 deletions
34
module.nix
34
module.nix
|
|
@ -20,6 +20,7 @@ let
|
|||
};
|
||||
userFlags = lib.concatMapStringsSep " " (user: "--editor ${lib.escapeShellArg user}") cfg.editors
|
||||
+ " " + lib.concatMapStringsSep " " (user: "--viewer ${lib.escapeShellArg user}") cfg.viewers;
|
||||
pushFlag = lib.optionalString (cfg.push.contact != null) " --push-contact ${lib.escapeShellArg cfg.push.contact}";
|
||||
in
|
||||
{
|
||||
options.services.flowtrack = {
|
||||
|
|
@ -45,6 +46,18 @@ in
|
|||
default = [ ];
|
||||
description = "Remote-User names with read-only access.";
|
||||
};
|
||||
push.contact = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
example = "https://flowtrack.example.org";
|
||||
description = "VAPID contact URL (https: or mailto:) sent to push services; null disables push notifications.";
|
||||
};
|
||||
push.time = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "*-*-* 09:00:00";
|
||||
example = "*-*-* 09:00:00 Europe/London";
|
||||
description = "systemd OnCalendar expression for the daily reminder check.";
|
||||
};
|
||||
backup = {
|
||||
directory = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
|
|
@ -73,12 +86,31 @@ in
|
|||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
serviceConfig = hardening // {
|
||||
ExecStart = "${cfg.package}/bin/flowtrack --host 127.0.0.1 --port ${toString cfg.port} --database ${database} ${userFlags}";
|
||||
ExecStart = "${cfg.package}/bin/flowtrack --host 127.0.0.1 --port ${toString cfg.port} --database ${database} ${userFlags}${pushFlag}";
|
||||
Restart = "on-failure";
|
||||
RestartSec = 3;
|
||||
};
|
||||
};
|
||||
}
|
||||
(lib.mkIf (cfg.push.contact != null) {
|
||||
systemd.services.flowtrack-notify = {
|
||||
description = "Send due Flowtrack reminders";
|
||||
after = [ "network-online.target" "flowtrack.service" ];
|
||||
wants = [ "network-online.target" ];
|
||||
serviceConfig = hardening // {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${cfg.package}/bin/flowtrack-notify daily --database ${database} --contact ${lib.escapeShellArg cfg.push.contact}";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.timers.flowtrack-notify = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnCalendar = cfg.push.time;
|
||||
Persistent = true;
|
||||
};
|
||||
};
|
||||
})
|
||||
(lib.mkIf (cfg.backup.directory != null) {
|
||||
systemd.tmpfiles.rules = [ "d ${cfg.backup.directory} 0700 flowtrack flowtrack -" ];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue