From feb0b2a40aab4bca4fb8c2b0b3ce8f88a9b50395 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 22 Aug 2024 23:31:30 +0200 Subject: [PATCH] modules/consul-service-registry: wait for consul-ready.target, use system management token --- modules/consul-service-registry/default.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/consul-service-registry/default.nix b/modules/consul-service-registry/default.nix index f0b20b5..1618a5d 100644 --- a/modules/consul-service-registry/default.nix +++ b/modules/consul-service-registry/default.nix @@ -12,6 +12,7 @@ let consulRegisterScript = pkgs.writeShellScript "consul-register" '' export CONSUL_HTTP_ADDR='${consulHttpAddr}' + export CONSUL_HTTP_TOKEN_FILE=/run/locksmith/consul-systemManagementToken while ! ${consul} services register "$1"; do sleep 1 done @@ -19,6 +20,7 @@ let consulDeregisterScript = pkgs.writeShellScript "consul-deregister" '' export CONSUL_HTTP_ADDR='${consulHttpAddr}' + export CONSUL_HTTP_TOKEN_FILE=/run/locksmith/consul-systemManagementToken for i in {1..5}; do if ${consul} services deregister "$1"; then break @@ -81,8 +83,8 @@ let }.${mode}; value = { direct = { - after = [ "consul-ready.service" ]; - requires = [ "consul-ready.service" ]; + after = [ "consul-ready.target" ]; + requires = [ "consul-ready.target" ]; serviceConfig = { ExecStartPost = register servicesJson; ExecStopPost = deregister servicesJson;