From 825efc9b29aeff859ad7cc481af639c1193b7dcc Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 17 Jul 2024 22:14:48 +0200 Subject: [PATCH] hosts: optionally set CONSUL_HTTP_ADDR from /etc/consul.json --- hosts/deploy.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hosts/deploy.nix b/hosts/deploy.nix index 830c75b..a645e1e 100644 --- a/hosts/deploy.nix +++ b/hosts/deploy.nix @@ -46,6 +46,9 @@ in ScheduleShutdown st reboot ''${nextScheduledTime}000000 ''; in pkgs.writeShellScript "post-effect.sh" '' + if [[ -e /etc/consul.json ]]; then + export CONSUL_HTTP_ADDR="$(${pkgs.jq}/bin/jq -r < /etc/consul.json '"\(.addresses.http // "127.0.0.1"):\(.ports.http // 8500)"')" + fi export PATH="${config.packages.consul}/bin:${pkgs.coreutils}/bin" if [[ "$(realpath /run/booted-system/kernel)" != "$(realpath /nix/var/nix/profiles/system/kernel)" ]]; then echo "Scheduling reboot for kernel upgrade"