install-osrf.sh: set ejabberd host correctly during registration on prod
authorJeff Davis <jdavis@sitka.bclibraries.ca>
Fri, 24 Aug 2018 22:01:29 +0000 (15:01 -0700)
committerJeff Davis <jdavis@sitka.bclibraries.ca>
Fri, 24 Aug 2018 22:01:29 +0000 (15:01 -0700)
deployment/install-osrf.sh

index 2dfe82f..4f6e35b 100755 (executable)
@@ -125,11 +125,16 @@ chgrp ejabberd /etc/ejabberd/ejabberd.yml
 chmod 640 /etc/ejabberd/ejabberd.yml
 systemctl stop ejabberd.service && systemctl start ejabberd.service
 if [[ ! -n "$SKIP_EJABBERD_REG" ]] ; then
+  if [[ ! -n "$PROD" ]] ; then
+    EJABBERD_HOST="localhost"
+  else
+    EJABBERD_HOST=$THISHOST
+  fi
   sleep 5
-  ejabberdctl register router private.localhost ${PRIVATE_ROUTER_PASSWD} && \
-  ejabberdctl register opensrf private.localhost ${PRIVATE_OPENSRF_PASSWD} && \
-  ejabberdctl register router public.localhost ${PUBLIC_ROUTER_PASSWD} && \
-  ejabberdctl register opensrf public.localhost ${PUBLIC_OPENSRF_PASSWD}
+  ejabberdctl register router private.${EJABBERD_HOST} ${PRIVATE_ROUTER_PASSWD} && \
+  ejabberdctl register opensrf private.${EJABBERD_HOST} ${PRIVATE_OPENSRF_PASSWD} && \
+  ejabberdctl register router public.${EJABBERD_HOST} ${PUBLIC_ROUTER_PASSWD} && \
+  ejabberdctl register opensrf public.${EJABBERD_HOST} ${PUBLIC_OPENSRF_PASSWD}
 fi
 
 echo "OpenSRF is installed!"