feat(agent): further adapt to openbao

Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
main
Raito Bezarius 1 month ago
parent 5aa5a794fd
commit 8be31345fa

@ -4,7 +4,7 @@
, ... , ...
}: }:
let let
cfg = config.services.vault; cfg = config.services.openbao;
settingsFormat = pkgs.formats.json { }; settingsFormat = pkgs.formats.json { };
autoAuthMethodModule = lib.types.submodule { autoAuthMethodModule = lib.types.submodule {
@ -60,9 +60,9 @@ let
}; };
in in
{ {
options.services.vault.agents = lib.mkOption { options.services.openbao.agents = lib.mkOption {
default = { }; default = { };
description = "Instances of vault agent"; description = "Instances of openbao agent";
type = lib.types.attrsOf (lib.types.submodule { type = lib.types.attrsOf (lib.types.submodule {
options = { options = {
settings = lib.mkOption { settings = lib.mkOption {
@ -75,7 +75,7 @@ in
config = { config = {
systemd.services = lib.mapAttrs' systemd.services = lib.mapAttrs'
(name: instanceCfg: (name: instanceCfg:
lib.nameValuePair "vault-agent-${name}" { lib.nameValuePair "openbao-agent-${name}" {
after = [ "network.target" ]; after = [ "network.target" ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
@ -87,7 +87,8 @@ in
path = [ pkgs.getent ]; path = [ pkgs.getent ];
serviceConfig = { serviceConfig = {
Restart = "on-failure"; Restart = "on-failure";
ExecStart = "${pkgs.vault}/bin/vault agent -config=${settingsFormat.generate "agent.json" instanceCfg.settings}"; # TODO: cfg.package
ExecStart = "${lib.getExe pkgs.openbao} agent -config=${settingsFormat.generate "agent.json" instanceCfg.settings}";
}; };
}) })
cfg.agents; cfg.agents;
Loading…
Cancel
Save