nixos/services/nginx_vHosts/tandoor.nix
2024-03-02 14:19:33 +01:00

29 lines
644 B
Nix

{
config,
lib,
...
}:
with lib;
let
tandoor = config.services.tandoor-recipes;
in {
vHost =
if tandoor.enable
then {
extraConfig = ''
location /media/ {
alias ${tandoor.extraConfig.MEDIA_ROOT};
}
location / {
proxy_pass http://${tandoor.address}:${toString tandoor.port};
proxy_set_header Host $host;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
'';
}
else {};
}
.vHost