WIP: Consul ACLs #117
1 changed files with 4 additions and 2 deletions
|
@ -12,6 +12,7 @@ let
|
||||||
|
|
||||||
consulRegisterScript = pkgs.writeShellScript "consul-register" ''
|
consulRegisterScript = pkgs.writeShellScript "consul-register" ''
|
||||||
export CONSUL_HTTP_ADDR='${consulHttpAddr}'
|
export CONSUL_HTTP_ADDR='${consulHttpAddr}'
|
||||||
|
export CONSUL_HTTP_TOKEN_FILE=/run/locksmith/consul-systemManagementToken
|
||||||
|
|||||||
while ! ${consul} services register "$1"; do
|
while ! ${consul} services register "$1"; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
@ -19,6 +20,7 @@ let
|
||||||
|
|
||||||
consulDeregisterScript = pkgs.writeShellScript "consul-deregister" ''
|
consulDeregisterScript = pkgs.writeShellScript "consul-deregister" ''
|
||||||
export CONSUL_HTTP_ADDR='${consulHttpAddr}'
|
export CONSUL_HTTP_ADDR='${consulHttpAddr}'
|
||||||
|
export CONSUL_HTTP_TOKEN_FILE=/run/locksmith/consul-systemManagementToken
|
||||||
for i in {1..5}; do
|
for i in {1..5}; do
|
||||||
if ${consul} services deregister "$1"; then
|
if ${consul} services deregister "$1"; then
|
||||||
break
|
break
|
||||||
|
@ -81,8 +83,8 @@ let
|
||||||
}.${mode};
|
}.${mode};
|
||||||
value = {
|
value = {
|
||||||
direct = {
|
direct = {
|
||||||
after = [ "consul-ready.service" ];
|
after = [ "consul-ready.target" ];
|
||||||
requires = [ "consul-ready.service" ];
|
requires = [ "consul-ready.target" ];
|
||||||
max
commented
ugly ugly
|
|||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStartPost = register servicesJson;
|
ExecStartPost = register servicesJson;
|
||||||
ExecStopPost = deregister servicesJson;
|
ExecStopPost = deregister servicesJson;
|
||||||
|
|
Loading…
Reference in a new issue
This should definitely be statically optional, i.e. can disable ACL support in this module.
This should probably be dynamically optional, i.e. check for the existence of the token file first. This could be useful for registering and/or running distributed Consul services before the ACL bootstrap is complete.