1
0
Fork 0

move haproxy vaultwarden config to default.nix

This commit is contained in:
ibizaman 2022-12-30 01:49:41 -08:00
parent 8d63d72b2d
commit a89b6b5afc

View file

@ -1,9 +1,36 @@
{ pkgs
, utils
}:
{ user ? "vaultwarden"
{ ingress ? 18005
, user ? "vaultwarden"
, group ? "vaultwarden"
, distribution ? {}
}:
let
addressOrLocalhost = distHaproxy: service:
if (builtins.head distHaproxy).properties.hostname == service.target.properties.hostname then
"127.0.0.1"
else
service.target.properties.hostname;
in
{
inherit user group;
haproxy = service: {
frontend = {
acl = {
acl_vaultwarden = "hdr_beg(host) vaultwarden.";
};
use_backend = "if acl_vaultwarden";
};
backend = {
servers = [
{
name = "ttrss1";
address = "${addressOrLocalhost distribution.HaproxyConfig service}:${builtins.toString ingress}";
}
];
};
};
}