diff --git a/tasks/wrapper.yml b/tasks/wrapper.yml index 5cfa382..732d0ab 100644 --- a/tasks/wrapper.yml +++ b/tasks/wrapper.yml @@ -2,5 +2,5 @@ - name: Create geth attach wrapper template: src: geth-attach-wrapper.sh - dest: /usr/local/bin/ageth + dest: '/usr/local/bin/ageth-{{ geth_cont_name }}' mode: 0755 diff --git a/templates/geth-attach-wrapper.sh b/templates/geth-attach-wrapper.sh index 5dcd8e4..5a6d665 100644 --- a/templates/geth-attach-wrapper.sh +++ b/templates/geth-attach-wrapper.sh @@ -1,6 +1,10 @@ #!/usr/bin/env bash + +GETH_RPC_PORT="{{ geth_rpc_port }}" +GETH_CONT_NAME="{{ geth_cont_name }}" + if [[ -z "$@" ]]; then - docker exec -it {{ geth_cont_name }} geth attach http://localhost:{{ geth_rpc_port }} + docker exec -it "${GETH_CONT_NAME}" geth attach "http://localhost:${GETH_RPC_PORT}" else - docker exec {{ geth_cont_name }} geth attach http://localhost:{{ geth_rpc_port }} --exec "$@" + docker exec "${GETH_CONT_NAME}" geth attach "http://localhost:${GETH_RPC_PORT}" --exec "$@" fi