nixos/calibre-server: fix service argument escaping (#498278)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
utils,
|
||||
...
|
||||
}:
|
||||
let
|
||||
@@ -11,20 +12,17 @@ let
|
||||
documentationLink = "https://manual.calibre-ebook.com";
|
||||
generatedDocumentationLink = documentationLink + "/generated/en/calibre-server.html";
|
||||
|
||||
execFlags = (
|
||||
lib.concatStringsSep " " (
|
||||
lib.mapAttrsToList (k: v: "${k} ${toString v}") (
|
||||
lib.filterAttrs (name: value: value != null) {
|
||||
"--listen-on" = cfg.host;
|
||||
"--port" = cfg.port;
|
||||
"--auth-mode" = cfg.auth.mode;
|
||||
"--userdb" = cfg.auth.userDb;
|
||||
}
|
||||
)
|
||||
++ [ (lib.optionalString (cfg.auth.enable == true) "--enable-auth") ]
|
||||
++ cfg.extraFlags
|
||||
execFlags =
|
||||
lib.mapAttrsToList (k: v: "--${k}=${toString v}") (
|
||||
lib.filterAttrs (name: value: value != null) {
|
||||
listen-on = cfg.host;
|
||||
port = cfg.port;
|
||||
auth-mode = cfg.auth.mode;
|
||||
userdb = cfg.auth.userDb;
|
||||
}
|
||||
)
|
||||
);
|
||||
++ lib.optional cfg.auth.enable "--enable-auth"
|
||||
++ cfg.extraFlags;
|
||||
in
|
||||
|
||||
{
|
||||
@@ -150,7 +148,9 @@ in
|
||||
serviceConfig = {
|
||||
User = cfg.user;
|
||||
Restart = "always";
|
||||
ExecStart = "${cfg.package}/bin/calibre-server ${lib.concatStringsSep " " cfg.libraries} ${execFlags}";
|
||||
ExecStart = utils.escapeSystemdExecArgs (
|
||||
[ "${cfg.package}/bin/calibre-server" ] ++ execFlags ++ [ "--" ] ++ cfg.libraries
|
||||
);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user