minor refactoring

This commit is contained in:
root 2024-06-14 23:50:52 +02:00
parent 0574a44093
commit 7f9ca9b1f0

View file

@ -1,6 +1,9 @@
{ config, lib, pkgs, ... }:
let localListenPort = 4443;
let
localListenPort = 4443;
localGrpcPort = 50442;
externalGrpcPort = 50443;
in {
services.headscale = {
enable = true;
@ -54,7 +57,7 @@ in {
# remotely with the CLI
# Note: Remote access _only_ works if you have
# valid certificates.
grpc_listen_addr = "127.0.0.1:50442";
grpc_listen_addr = "127.0.0.1:" + builtins.toString localGrpcPort;
# Allow the gRPC admin interface to run in INSECURE
# mode. This is not recommended as the traffic will
@ -95,18 +98,18 @@ in {
listen = [
{
addr = "0.0.0.0";
port = 50443;
port = externalGrpcPort;
ssl = true;
}
{
addr = "[::]";
port = 50443;
port = externalGrpcPort;
ssl = true;
}
];
locations."/" = {
extraConfig = ''
grpc_pass grpc://127.0.0.1:50442;
grpc_pass grpc://127.0.0.1:${builtins.toString localGrpcPort};
'';
};
};