Skip to content

Commit ad0f639

Browse files
womfoozimbatm
authored andcommittedSep 24, 2017
influxdb sevice: make postStart test work with non-localhost configurations (#29734)
make postStart test work with non-localhost configurations (cherry picked from commit 412fa16)
1 parent 40b0653 commit ad0f639

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed
 

‎nixos/modules/services/databases/influxdb.nix

+10-5
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,16 @@ in
170170
mkdir -m 0770 -p ${cfg.dataDir}
171171
if [ "$(id -u)" = 0 ]; then chown -R ${cfg.user}:${cfg.group} ${cfg.dataDir}; fi
172172
'';
173-
postStart = mkBefore ''
174-
until ${pkgs.curl.bin}/bin/curl -s -o /dev/null ${if configOptions.http.https-enabled then "-k https" else "http"}://127.0.0.1${toString configOptions.http.bind-address}/ping; do
175-
sleep 1;
176-
done
177-
'';
173+
postStart =
174+
let
175+
scheme = if configOptions.http.https-enabled then "-k https" else "http";
176+
bindAddr = (ba: if hasPrefix ":" ba then "127.0.0.1${ba}" else "${ba}")(toString configOptions.http.bind-address);
177+
in
178+
mkBefore ''
179+
until ${pkgs.curl.bin}/bin/curl -s -o /dev/null ${scheme}://${bindAddr}/ping; do
180+
sleep 1;
181+
done
182+
'';
178183
};
179184

180185
users.extraUsers = optional (cfg.user == "influxdb") {

0 commit comments

Comments
 (0)
Please sign in to comment.