Skip to content

Commit

Permalink
influxdb sevice: make postStart test work with non-localhost configur…
Browse files Browse the repository at this point in the history
…ations (#29734)

make postStart test work with non-localhost configurations
  • Loading branch information
womfoo authored and zimbatm committed Sep 24, 2017
1 parent 5fa6b34 commit 412fa16
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions nixos/modules/services/databases/influxdb.nix
Expand Up @@ -170,11 +170,16 @@ in
mkdir -m 0770 -p ${cfg.dataDir}
if [ "$(id -u)" = 0 ]; then chown -R ${cfg.user}:${cfg.group} ${cfg.dataDir}; fi
'';
postStart = mkBefore ''
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
sleep 1;
done
'';
postStart =
let
scheme = if configOptions.http.https-enabled then "-k https" else "http";
bindAddr = (ba: if hasPrefix ":" ba then "127.0.0.1${ba}" else "${ba}")(toString configOptions.http.bind-address);
in
mkBefore ''
until ${pkgs.curl.bin}/bin/curl -s -o /dev/null ${scheme}://${bindAddr}/ping; do
sleep 1;
done
'';
};

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

0 comments on commit 412fa16

Please sign in to comment.