chore(bbuddy): websocket screen service

This commit is contained in:
arcnmx 2024-03-22 11:01:42 -07:00
parent dc0c84c0a0
commit c51fdb847b
2 changed files with 48 additions and 8 deletions

View file

@ -1,5 +1,5 @@
{config, lib, ...}: let
inherit (lib.modules) mkDefault;
inherit (lib.modules) mkIf mkMerge mkAfter mkDefault;
inherit (config.services) nginx;
cfg = config.services.barcodebuddy;
in {
@ -11,11 +11,23 @@ in {
EXTERNAL_GROCY_URL = "https://grocy.${config.networking.domain}";
DISABLE_AUTHENTICATION = true;
};
nginxPhpConfig = ''
include ${config.sops.secrets.barcodebuddy-fastcgi-params.path};
'';
nginxPhpConfig = mkMerge [
''
include ${config.sops.secrets.barcodebuddy-fastcgi-params.path};
''
(mkIf nginx.virtualHosts.barcodebuddy.proxied.enabled (mkAfter ''
set $bbuddy_https "";
if ($x_scheme = https) {
set $bbuddy_https 1;
}
fastcgi_param HTTPS $bbuddy_https if_not_empty;
fastcgi_param REQUEST_SCHEME $x_scheme;
fastcgi_param HTTP_HOST $x_forwarded_host;
''))
];
};
config.services.nginx.virtualHosts.barcodebuddy = {
config.services.nginx.virtualHosts.barcodebuddy = mkIf cfg.enable {
proxied.xvars.enable = true;
vouch = {
enable = true;
requireAuth = false;
@ -31,7 +43,10 @@ in {
};
};
};
config.sops.secrets.barcodebuddy-fastcgi-params = {
config.users.users.barcodebuddy = mkIf cfg.enable {
uid = 912;
};
config.sops.secrets.barcodebuddy-fastcgi-params = mkIf cfg.enable {
sopsFile = mkDefault ./secrets/barcodebuddy.yaml;
owner = mkDefault nginx.user;
};