mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
feat(grocy): vouch reverse-proxy auth
This commit is contained in:
parent
c27a8da537
commit
bae4f32eff
7 changed files with 388 additions and 68 deletions
36
nixos/access/grocy.nix
Normal file
36
nixos/access/grocy.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkDefault;
|
||||
inherit (config.services) grocy nginx;
|
||||
name.shortServer = mkDefault "grocy";
|
||||
in {
|
||||
config.services.nginx.virtualHosts = {
|
||||
grocy = {
|
||||
inherit name;
|
||||
locations."/" = mkIf (!grocy.enable) {
|
||||
proxy.headers.enableRecommended = true;
|
||||
extraConfig = ''
|
||||
set $x_proxy_host ${nginx.virtualHosts.grocy.serverName};
|
||||
'';
|
||||
};
|
||||
};
|
||||
grocy'local = {
|
||||
inherit name;
|
||||
local.enable = mkDefault true;
|
||||
locations."/" = mkIf (!grocy.enable) {
|
||||
proxyPass = mkDefault (if grocy.enable
|
||||
then "http://localhost:${nginx.defaultHTTPListenPort}"
|
||||
else nginx.virtualHosts.grocy.locations."/".proxyPass
|
||||
);
|
||||
proxy.headers.enableRecommended = true;
|
||||
extraConfig = ''
|
||||
set $x_proxy_host ${nginx.virtualHosts.grocy.serverName};
|
||||
proxy_redirect $x_scheme://${nginx.virtualHosts.grocy.serverName}/ $x_scheme://$x_host/;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue