move haproxy vaultwarden config to default.nix
This commit is contained in:
parent
8d63d72b2d
commit
a89b6b5afc
1 changed files with 28 additions and 1 deletions
|
@ -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}";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue