From dfd49c656a49ac6ea737c9d2d67686f1044f6e85 Mon Sep 17 00:00:00 2001 From: oddlama Date: Thu, 17 Aug 2023 17:18:28 +0200 Subject: [PATCH] fix: more robust resolving of influxdb2 provisioning address --- modules/meta/influxdb2.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/meta/influxdb2.nix b/modules/meta/influxdb2.nix index e36d593..ac71525 100644 --- a/modules/meta/influxdb2.nix +++ b/modules/meta/influxdb2.nix @@ -17,6 +17,7 @@ genAttrs getExe hasAttr + hasInfix head literalExpression mkBefore @@ -24,8 +25,8 @@ mkIf mkOption optional - optionalString optionals + optionalString types unique ; @@ -64,7 +65,13 @@ provisioningScript = pkgs.writeShellScript "post-start-provision" ('' set -euo pipefail - export INFLUX_HOST="http://"${escapeShellArg (cfg.settings.http-bind-address or "localhost:8086")} + export INFLUX_HOST="http://"${escapeShellArg ( + if + ! hasAttr "http-bind-address" cfg.settings + || hasInfix "0.0.0.0" cfg.settings.http-bind-address + then "localhost:8086" + else cfg.settings.http-bind-address + )} # Wait for the influxdb server to come online count=0