Created
June 17, 2015 14:46
-
-
Save drnic/42e27e846f9ef7919599 to your computer and use it in GitHub Desktop.
Target current BOSH's current CF manifest and run nats CLI on its nats configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Assumes using nats CLI from https://github.com/soutenniza/nats/releases | |
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | |
cd $DIR/.. | |
bosh_target=$(cat .bosh_config | yaml2json | jq -r ".target") | |
manifest=$(cat .bosh_config | yaml2json | jq -r ".deployment[\"$bosh_target\"]") | |
mbus=$(cat $manifest | yaml2json | jq -r '.properties.nats | "nats://\(.user):\(.password)@\(.address):\(.port)"') | |
command=$1; shift | |
if [[ "${command}X" == "X" ]]; then | |
echo "USAGE: ./bin/nats.sh [pub|sub] ARGS" | |
exit 1 | |
fi | |
nats $command -s $mbus $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment