Changed rabbitmq settings
This commit is contained in:
parent
daa1850ed8
commit
be3f768358
3 changed files with 47 additions and 14 deletions
|
@ -37,16 +37,55 @@ read_setting(){
|
|||
POSTGRESQL_SERVER_USER=${POSTGRESQL_SERVER_USER:-$(${JSON} services.CoAuthoring.sql.dbUser)}
|
||||
POSTGRESQL_SERVER_PASS=${POSTGRESQL_SERVER_PASS:-$(${JSON} services.CoAuthoring.sql.dbPass)}
|
||||
|
||||
RABBITMQ_SERVER_URL=$(${JSON} rabbitmq.url)
|
||||
RABBITMQ_SERVER_HOST=${RABBITMQ_SERVER_HOST:-${RABBITMQ_SERVER_URL#'amqp://'}}
|
||||
RABBITMQ_SERVER_USER=${RABBITMQ_SERVER_USER:-$(${JSON} rabbitmq.login)}
|
||||
RABBITMQ_SERVER_PASS=${RABBITMQ_SERVER_PASS:-$(${JSON} rabbitmq.password)}
|
||||
RABBITMQ_SERVER_PORT=${RABBITMQ_SERVER_PORT:-"5672"}
|
||||
RABBITMQ_SERVER_URL=${RABBITMQ_SERVER_URL:-$(${JSON} rabbitmq.url)}
|
||||
parse_rabbitmq_url
|
||||
|
||||
REDIS_SERVER_HOST=${REDIS_SERVER_HOST:-$(${JSON} services.CoAuthoring.redis.host)}
|
||||
REDIS_SERVER_PORT=${REDIS_SERVER_PORT:-$(${JSON} services.CoAuthoring.redis.port)}
|
||||
}
|
||||
|
||||
parse_rabbitmq_url(){
|
||||
local amqp=${RABBITMQ_SERVER_URL}
|
||||
|
||||
# extract the protocol
|
||||
local proto="$(echo $amqp | grep :// | sed -e's,^\(.*://\).*,\1,g')"
|
||||
# remove the protocol
|
||||
local url="$(echo ${amqp/$proto/})"
|
||||
|
||||
# extract the user and password (if any)
|
||||
local userpass="`echo $url | grep @ | cut -d@ -f1`"
|
||||
local pass=`echo $userpass | grep : | cut -d: -f2`
|
||||
|
||||
local user
|
||||
if [ -n "$pass" ]; then
|
||||
user=`echo $userpass | grep : | cut -d: -f1`
|
||||
else
|
||||
user=$userpass
|
||||
fi
|
||||
echo $user
|
||||
|
||||
# extract the host
|
||||
local hostport="$(echo ${url/$userpass@/} | cut -d/ -f1)"
|
||||
# by request - try to extract the port
|
||||
local port="$(echo $hostport | sed -e 's,^.*:,:,g' -e 's,.*:\([0-9]*\).*,\1,g' -e 's,[^0-9],,g')"
|
||||
|
||||
local host
|
||||
if [ -n "$port" ]; then
|
||||
host=`echo $hostport | grep : | cut -d: -f1`
|
||||
else
|
||||
host=$hostport
|
||||
port="5672"
|
||||
fi
|
||||
|
||||
# extract the path (if any)
|
||||
local path="$(echo $url | grep / | cut -d/ -f2-)"
|
||||
|
||||
RABBITMQ_SERVER_HOST=$host
|
||||
RABBITMQ_SERVER_USER=$user
|
||||
RABBITMQ_SERVER_PASS=$pass
|
||||
RABBITMQ_SERVER_PORT=$port
|
||||
}
|
||||
|
||||
waiting_for_connection(){
|
||||
until nc -z -w 3 "$1" "$2"; do
|
||||
>&2 echo "Waiting for connection to the $1 host on port $2"
|
||||
|
@ -77,9 +116,7 @@ update_postgresql_settings(){
|
|||
}
|
||||
|
||||
update_rabbitmq_setting(){
|
||||
${JSON} -I -e "this.rabbitmq.url = 'amqp://${RABBITMQ_SERVER_HOST}'"
|
||||
${JSON} -I -e "this.rabbitmq.login = '${RABBITMQ_SERVER_USER}'"
|
||||
${JSON} -I -e "this.rabbitmq.password = '${RABBITMQ_SERVER_PASS}'"
|
||||
${JSON} -I -e "this.rabbitmq.url = '${RABBITMQ_SERVER_URL}'"
|
||||
}
|
||||
|
||||
update_redis_settings(){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue