From d739394ae24010562c8cb1e8c756fb71df892e70 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Tue, 14 Oct 2025 03:16:15 +0000 Subject: [PATCH] Specify the bind port directly It's not a secret, and this will make it possible to use the address/interface configured in the host configuration. --- configs/frps/frps.toml | 1 - modules/system/frps.nix | 10 ++++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/configs/frps/frps.toml b/configs/frps/frps.toml index c4484c8..cd4034e 100644 --- a/configs/frps/frps.toml +++ b/configs/frps/frps.toml @@ -1,7 +1,6 @@ # frps.toml auth.method = "token" auth.token = "{{ .Envs.FRPS_AUTH_TOKEN }}" -bindAddr = "{{ .Envs.FRPS_BIND_ADDRESS }}" bindPort = {{ .Envs.FRPS_BIND_PORT }} vhostHTTPPort = {{ .Envs.FRPS_VHOST_HTTP_PORT }} diff --git a/modules/system/frps.nix b/modules/system/frps.nix index 417efbd..2afeb94 100644 --- a/modules/system/frps.nix +++ b/modules/system/frps.nix @@ -4,7 +4,9 @@ let group = "frps"; user = "frps"; in { - options.myModules.frps.enable = mkEnableOption "custom frps configuration"; + options.myModules.frps = { + enable = mkEnableOption "custom frps configuration"; + }; config = mkIf config.myModules.frps.enable { environment = { etc."frps.toml".source = "${configFiles}/frps/frps.toml"; @@ -24,11 +26,15 @@ in { systemd.services.frps = { after=["network.target" "network-online.target"]; description="FRP server process"; + environment = { + FRPS_BIND_PORT="7000"; + FRPS_VHOST_HTTP_PORT="8000"; + }; requires=["network-online.target"]; restartIfChanged = true; stopIfChanged = true; serviceConfig = { - EnvironmentFile="/var/run/secrets/frps-env"; + EnvironmentFile = "/var/run/secrets/frps-env"; Type = "simple"; User = "${user}"; Group = "${group}";