Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

Pass RUST_LOG to cli #2293

Merged
merged 3 commits into from
Oct 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docker/iml-cli-proxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@

trailer=$(docker service ps -f 'name=iml_iml-manager-cli.1' iml_iml-manager-cli -q --no-trunc | head -n1)
TTYOPT=$(tty -s && echo "-t")
ENVOPT=""
if [ -n "$RUST_LOG" ]; then
ENVOPT="-e RUST_LOG=$RUST_LOG"
fi

docker exec -i $TTYOPT iml_iml-manager-cli.1.$trailer iml "${@:1}"
docker exec -i $TTYOPT $ENVOPT iml_iml-manager-cli.1.$trailer iml "${@:1}"
Comment on lines +5 to +10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit.
Since we use bash anyway, to avoid any chance for problem with spaces:

ENVOPTS=()
if [ -n "$RUST_LOG" ]; then
	ENVOPTS+=( -e "RUST_LOG=$RUST_LOG" )
fi
docker exec -i $TTYOPT "${ENVOPTS[@]}" iml_iml-manager-cli.1.$trailer iml "${@:1}"

Could also construct the entire docker command this way.