feat: Add local vhost resolution via extraHosts
This commit is contained in:
parent
44af2887a5
commit
7217af2233
@ -73,6 +73,12 @@ in
|
||||
default = { };
|
||||
description = "An attribute set of location configurations.";
|
||||
};
|
||||
|
||||
resolveLocally = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "If true, ensure the vhost is resolvable to 127.0.0.1 locally on this server.";
|
||||
};
|
||||
};
|
||||
});
|
||||
default = { };
|
||||
@ -114,5 +120,11 @@ in
|
||||
conf.locations;
|
||||
})
|
||||
cfg.hosts;
|
||||
|
||||
networking.extraHosts = concatMapStringsSep "\n"
|
||||
(domain:
|
||||
mkIf cfg.hosts.${domain}.resolveLocally "127.0.0.1 ${domain}"
|
||||
)
|
||||
(lib.attrNames cfg.hosts);
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user