From 5bb067158899ba079c0f0b2f0a7f0ab895507284 Mon Sep 17 00:00:00 2001 From: TsjipTsjip <19798667+TsjipTsjip@users.noreply.github.com> Date: Fri, 8 Nov 2024 15:09:04 +0100 Subject: [PATCH] Pass token via environment variable. (#33) --- .../Components/ServerManagement/ServerInstance.Actor.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/SS14.Watchdog/Components/ServerManagement/ServerInstance.Actor.cs b/SS14.Watchdog/Components/ServerManagement/ServerInstance.Actor.cs index 1d68df6..e5d3fd6 100644 --- a/SS14.Watchdog/Components/ServerManagement/ServerInstance.Actor.cs +++ b/SS14.Watchdog/Components/ServerManagement/ServerInstance.Actor.cs @@ -329,9 +329,10 @@ private async Task StartServer(CancellationToken cancel) var args = new List { // Watchdog comms config. - "--cvar", $"watchdog.token={Secret}", "--cvar", $"watchdog.key={Key}", "--cvar", $"watchdog.baseUrl={_baseServerAddress}", + // watchdog.token provided through ENV vars, as this does not show up in process listings + // like `ps -aux` or `htop`. "--config-file", Path.Combine(InstanceDir, "config.toml"), "--data-dir", Path.Combine(InstanceDir, "data"), @@ -343,7 +344,11 @@ private async Task StartServer(CancellationToken cancel) args.Add(arg); } - var env = new List<(string, string)>(); + var env = new List<(string, string)> + { + // __ is replaced by a . when parsing CVars from an environment variable. + ("ROBUST_CVAR_watchdog__token", $"{Secret}") + }; foreach (var (envVar, value) in _instanceConfig.EnvironmentVariables) {