forked from M-Labs/it-infra
afws: enable file logging with afws group permissions
This commit is contained in:
parent
98c1ecd325
commit
d1236d548d
|
@ -10,16 +10,34 @@ in
|
|||
default = false;
|
||||
description = "Enable AFWS server";
|
||||
};
|
||||
logFile = mkOption {
|
||||
type = types.str;
|
||||
default = "/var/lib/afws/logs/afws.log";
|
||||
description = "Path to the log file";
|
||||
};
|
||||
logBackupCount = mkOption {
|
||||
type = types.int;
|
||||
default = 30;
|
||||
description = "Number of daily log files to keep";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf config.services.afws.enable {
|
||||
systemd.services.afws = {
|
||||
description = "AFWS server";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
preStart = ''
|
||||
mkdir -p "$(dirname ${config.services.afws.logFile})"
|
||||
chown afws:afws "$(dirname ${config.services.afws.logFile})"
|
||||
'';
|
||||
serviceConfig = {
|
||||
User = "afws";
|
||||
Group = "afws";
|
||||
ExecStart = "${afws}/bin/afws_server";
|
||||
ExecStart = ''
|
||||
${afws}/bin/afws_server \
|
||||
--log-file ${config.services.afws.logFile} \
|
||||
--log-backup-count ${toString config.services.afws.logBackupCount}
|
||||
'';
|
||||
ExecReload = "${pkgs.coreutils}/bin/kill -USR1 $MAINPID";
|
||||
};
|
||||
path = [ pkgs.nix pkgs.git ];
|
||||
|
|
Loading…
Reference in New Issue