fix: more robust resolving of influxdb2 provisioning address

This commit is contained in:
oddlama 2023-08-17 17:18:28 +02:00
parent f29318a5ac
commit dfd49c656a
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A

View file

@ -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