|
|
|
@ -19,7 +19,7 @@ |
|
|
|
|
# |
|
|
|
|
|
|
|
|
|
name="$(cat "$__object/parameter/name" 2>/dev/null || echo "$__object_id")" |
|
|
|
|
conf_dir="/etc/consul/conf.d" |
|
|
|
|
conf_dir=$(cat "$__object/explorer/conf-dir") |
|
|
|
|
conf_file="service_${name}.json" |
|
|
|
|
state="$(cat "$__object/parameter/state")" |
|
|
|
|
|
|
|
|
@ -45,7 +45,7 @@ printf ' "name": "%s"\n' "$name" |
|
|
|
|
cd "$__object/parameter/" |
|
|
|
|
for param in *; do |
|
|
|
|
case "$param" in |
|
|
|
|
state|name|check-interval) continue ;; |
|
|
|
|
state|name|check-interval|conf-dir) continue ;; |
|
|
|
|
check-script) |
|
|
|
|
printf ' ,"check": {\n' |
|
|
|
|
printf ' "script": "%s"\n' "$(cat "$__object/parameter/check-script")" |
|
|
|
@ -86,7 +86,6 @@ echo " }" |
|
|
|
|
# end json file |
|
|
|
|
echo "}" |
|
|
|
|
) | \ |
|
|
|
|
require="__directory${conf_dir}" \ |
|
|
|
|
__config_file "${conf_dir}/${conf_file}" \ |
|
|
|
|
--owner root --group consul --mode 640 \ |
|
|
|
|
--state "$state" \ |
|
|
|
|