update pvlog

This commit is contained in:
Kopatz
2025-11-22 14:26:43 +01:00
parent 943584e20b
commit e97d1c0947
4 changed files with 51 additions and 1 deletions

View File

@@ -27,6 +27,16 @@ in
default = "/";
description = "Location under which the data logger is reachable";
};
fqdn = mkOption {
type = types.str;
default = "pvlog.home.arpa";
description = "FQDN under which the data logger is reachable";
};
useStepCa = mkOption {
type = types.bool;
default = true;
description = "Use step-ca for ACME certificates";
};
};
};
@@ -38,6 +48,22 @@ in
group = "kop-pvlog";
};
users.groups.kop-pvlog = { };
security.acme.certs."${cfg.fqdn}" = lib.mkIf cfg.useStepCa {
server = "https://127.0.0.1:8443/acme/kop-acme/directory";
};
services.nginx.virtualHosts."${cfg.fqdn}" = {
forceSSL = true;
enableACME = true;
quic = true;
http3 = true;
locations."/".proxyPass = "http://127.0.0.1:${builtins.toString cfg.port}";
locations."/".extraConfig = ''
more_clear_headers 'x-frame-options';
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
add_header Access-Control-Allow-Headers "Authorization, Origin, X-Requested-With, Content-Type, Accept";
'';
};
systemd.services.kop-pvlog = {
description = "Fronius data logger";
wants = [ "network-online.target" ];