diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index bf07420a6..7139b822a 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -8,6 +8,7 @@ usage() { # This script exists to modify the network settings in the scope containers # as docker doesn't allow it when started with --net=host +mkdir -p /etc/weave APP_ARGS="" PROBE_ARGS="" @@ -24,7 +25,7 @@ while true; do shift ;; --app.*) - if echo "$1" | grep "="; then + if echo "$1" | grep "=" 1>/dev/null; then ARG_NAME=$(echo "$1" | sed 's/\-\-app\.\([^=]*\)=\(.*\)/\1/') ARG_VALUE=$(echo "$1" | sed 's/\-\-app\.\([^=]*\)=\(.*\)/\2/') else @@ -36,7 +37,7 @@ while true; do APP_ARGS="$APP_ARGS -$ARG_NAME=$ARG_VALUE" ;; --probe.*) - if echo "$1" | grep "="; then + if echo "$1" | grep "=" 1>/dev/null; then ARG_NAME=$(echo "$1" | sed 's/\-\-probe\.\([^=]*\)=\(.*\)/\1/') ARG_VALUE=$(echo "$1" | sed 's/\-\-probe\.\([^=]*\)=\(.*\)/\2/') else @@ -47,6 +48,18 @@ while true; do fi PROBE_ARGS="$PROBE_ARGS -$ARG_NAME=$ARG_VALUE" ;; + --service-token*) + if echo "$1" | grep "=" 1>/dev/null; then + ARG_VALUE=$(echo "$1" | sed 's/\-\-service-token=\(.*\)/\1/') + else + [ $# -gt 1 ] || usage + ARG_VALUE="$2" + shift + fi + PROBE_ARGS="$PROBE_ARGS -token=$ARG_VALUE" + echo "run.weave.works:80" >/etc/weave/apps + touch /etc/service/app/down + ;; --no-app) touch /etc/service/app/down ;; @@ -60,7 +73,6 @@ while true; do shift done -mkdir -p /etc/weave echo "$APP_ARGS" >/etc/weave/scope-app.args echo "$PROBE_ARGS" >/etc/weave/scope-probe.args @@ -75,6 +87,6 @@ fi # using Weave DNS. We stick these in /etc/weave/apps # for the run-probe script to pick up. MANUAL_APPS=$@ -echo "$MANUAL_APPS" >/etc/weave/apps +echo "$MANUAL_APPS" >>/etc/weave/apps exec /sbin/runsvdir /etc/service diff --git a/scope b/scope index 563d56123..caf15ede3 100755 --- a/scope +++ b/scope @@ -175,10 +175,12 @@ case "$COMMAND" in echo $CONTAINER - echo "Weave Scope is reachable at the following URL(s):" >&2 - for ip in $IP_ADDRS; do - echo " * http://$ip:4040/" >&2 - done + if ! echo "$@" | grep -E "\-\-no\-app|\-\-service\-token" 1>/dev/null; then + echo "Weave Scope is reachable at the following URL(s):" >&2 + for ip in $IP_ADDRS; do + echo " * http://$ip:4040/" >&2 + done + fi ;; stop)