2024-07-22 01:21:55 +03:00
|
|
|
{ cluster, config, depot, lib, ... }:
|
2024-07-21 00:52:16 +03:00
|
|
|
|
|
|
|
let
|
|
|
|
apiLink = cluster.config.hostLinks.${config.networking.hostName}.frangiclave-server;
|
|
|
|
clusterLink = cluster.config.hostLinks.${config.networking.hostName}.frangiclave-cluster;
|
|
|
|
in
|
2024-07-20 23:18:01 +03:00
|
|
|
|
|
|
|
{
|
|
|
|
services.vault = {
|
|
|
|
enable = true;
|
|
|
|
package = depot.packages.openbao;
|
2024-07-21 00:52:16 +03:00
|
|
|
address = apiLink.tuple;
|
|
|
|
extraConfig = /*hcl*/ ''
|
|
|
|
api_addr = "${apiLink.url}"
|
|
|
|
cluster_addr = "${clusterLink.url}"
|
|
|
|
'';
|
|
|
|
|
|
|
|
storageBackend = "raft";
|
|
|
|
storageConfig = /*hcl*/ ''
|
|
|
|
node_id = "x${builtins.hashString "sha256" "frangiclave-node-${config.networking.hostName}"}"
|
2024-07-22 01:21:55 +03:00
|
|
|
${
|
|
|
|
lib.pipe (cluster.config.services.frangiclave.otherNodes.server config.networking.hostName) [
|
|
|
|
(map (node: cluster.config.hostLinks.${node}.frangiclave-server))
|
|
|
|
(map (link: /*hcl*/ ''
|
|
|
|
retry_join {
|
|
|
|
leader_api_addr = "${link.url}"
|
|
|
|
}
|
|
|
|
''))
|
|
|
|
(lib.concatStringsSep "\n")
|
|
|
|
]
|
|
|
|
}
|
2024-07-21 00:52:16 +03:00
|
|
|
'';
|
2024-07-20 23:18:01 +03:00
|
|
|
};
|
|
|
|
}
|