diff --git a/Dockerfile b/Dockerfile index 7198427..9149e1c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,7 @@ MAINTAINER Pierre Besson https://github.com/PierreBesson RUN apk --update add nodejs git openssh curl bash inotify-tools jq && \ rm -rf /var/cache/apk/* && \ + npm install -g simplywatch && \ npm install -g git2consul@0.12.12 && \ mkdir -p /etc/git2consul.d diff --git a/docker-compose.yml b/docker-compose.yml index 32f845d..6dee963 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,3 +16,4 @@ services: - CONFIG_MODE=filesystem #- CONFIG_MODE=git - INIT_SLEEP_SECONDS=5 + - CONSUL_URL=consul diff --git a/load-config.sh b/load-config.sh index db138bd..5bbc5a5 100755 --- a/load-config.sh +++ b/load-config.sh @@ -36,10 +36,8 @@ if [[ "$CONFIG_MODE" == "filesystem" ]]; then loadPropertiesFilesIntoConsul # Reload the files when there is a file change - inotifywait -q -m --format '%f' -e close_write $CONFIG_DIR/ | while read - do - loadPropertiesFilesIntoConsul - done + simplywatch -g "$CONFIG_DIR/**" -x "curl --output /dev/null -sX PUT --data-binary @{{path}} http://$CONSUL_URL:$CONSUL_PORT/v1/kv/config/{{name}}/data && echo ' Consul Config reloaded'" + fi if [[ "$CONFIG_MODE" == "git" ]]; then