module: support additional properties in "ak"

This changes the "ak" script to contain all properties from the
authentik.service unit except the Exec* and Restart* properties. This allows the
script to work when the user has added additional properties to the unit (e.g.
the `SupplementaryGroups` property to connect to Redis over a Unix socket).
This commit is contained in:
Quentin Smith 2025-08-26 17:17:41 -04:00
parent 1361d269fe
commit 940f49870b
No known key found for this signature in database
GPG key ID: 04EE05A8FCEFB697

View file

@ -196,13 +196,17 @@ in
# `systemd-run(1)` in order to spin up an environment with correct (dynamic) user, # `systemd-run(1)` in order to spin up an environment with correct (dynamic) user,
# state directory and environment to run `ak` inside. # state directory and environment to run `ak` inside.
(k: vs: map (v: "--property ${k}=${if isBool v then boolToString v else toString v}") (toList vs)) (k: vs: map (v: "--property ${k}=${if isBool v then boolToString v else toString v}") (toList vs))
# Read serviceDefaults from `authentik.service`. That way, module system primitives (mk*) # Read properties from `authentik.service`. That way, users can customize the properties using
# can be used inside `serviceDefaults` and it doesn't need to be evaluated here again. # module system primitives and the like.
( (
getAttrs (attrNames serviceDefaults) config.systemd.services.authentik.serviceConfig removeAttrs config.systemd.services.authentik.serviceConfig [
// { "ExecStart"
StateDirectory = "authentik"; "ExecStartPre"
} "Restart"
"RestartSec"
# systemd-run doesn't expand the %S specifier, so this is passed separately below.
"WorkingDirectory"
]
) )
); );
in in