Skip to content

Instantly share code, notes, and snippets.

@wwerner
Created March 18, 2019 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wwerner/b0d744c5646cdbc4877353c46a4fae2b to your computer and use it in GitHub Desktop.
Save wwerner/b0d744c5646cdbc4877353c46a4fae2b to your computer and use it in GitHub Desktop.
# Parse a CloudAmqp RabbitMQ URL from heroku into environment variables
# that Spring Boot understands.
export CLOUDAMQP_URL=amqp://user:pass@host/vhost
MSG_TMP=$(echo $CLOUDAMQP_URL | cut -d':' -f2- | sed 's/^\/\///')
MSG_TMP_USER_PASS=$(echo $MSG_TMP | cut -d'@' -f1)
SPRING_RABBITMQ_USERNAME=$(echo $MSG_TMP_USER_PASS | cut -d':' -f1)
SPRING_RABBITMQ_PASSWORD=$(echo $MSG_TMP_USER_PASS | cut -d':' -f2)
MSG_TMP_HOST_VHOST=$(echo $MSG_TMP | cut -d'@' -f2-)
SPRING_RABBITMQ_HOST=$(echo $MSG_TMP_HOST_VHOST | cut -d'/' -f1)
SPRING_RABBITMQ_VIRTUAL_HOST=$(echo $MSG_TMP_HOST_VHOST | cut -d'/' -f2)
export SPRING_RABBITMQ_PORT = 5672
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment