|
|
@ -16,14 +16,35 @@
|
|
|
|
# specific language governing permissions and limitations
|
|
|
|
# specific language governing permissions and limitations
|
|
|
|
# under the License.
|
|
|
|
# under the License.
|
|
|
|
|
|
|
|
|
|
|
|
CONFIG_PATH=/opt/emqx/etc/plugins/emqx_exhook.conf
|
|
|
|
CONFIG_PATH=/opt/emqx/configs/emqx_exhook.conf
|
|
|
|
|
|
|
|
EMQX_DATA_PATH=/opt/emqx/data/loaded_plugins
|
|
|
|
|
|
|
|
|
|
|
|
# Set emqx_exhook.conf configs
|
|
|
|
if [ -f "$CONFIG_PATH" ]
|
|
|
|
|
|
|
|
then
|
|
|
|
|
|
|
|
echo "$CONFIG_PATH found. Populating templates"
|
|
|
|
|
|
|
|
# Backup config files
|
|
|
|
|
|
|
|
cp $CONFIG_PATH $CONFIG_PATH.template
|
|
|
|
|
|
|
|
CONFIG_TEMPLATE_PATH=$CONFIG_PATH.template
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "Setting up configurations"
|
|
|
|
|
|
|
|
# emqx_exhook.conf
|
|
|
|
sed -i 's/${SERVER_HOSTNAME}/'$SERVER_HOSTNAME'/g' $CONFIG_PATH
|
|
|
|
sed -i 's/${SERVER_HOSTNAME}/'$SERVER_HOSTNAME'/g' $CONFIG_PATH
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Copy configuration and data file
|
|
|
|
|
|
|
|
cp $CONFIG_PATH /opt/emqx/etc/plugins/emqx_exhook.conf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rm -f $EMQX_DATA_PATH
|
|
|
|
|
|
|
|
cp /opt/data/loaded_plugins $EMQX_DATA_PATH
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Add plugins
|
|
|
|
if [ -f "$CONFIG_PATH" ]
|
|
|
|
rm -f /opt/emqx/data/loaded_plugins
|
|
|
|
then
|
|
|
|
mv /opt/data/loaded_plugins /opt/emqx/data/loaded_plugins
|
|
|
|
# Removing edited files
|
|
|
|
|
|
|
|
rm -f $CONFIG_PATH
|
|
|
|
|
|
|
|
# Reverting template files to originals
|
|
|
|
|
|
|
|
mv $CONFIG_TEMPLATE_PATH $CONFIG_PATH
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
echo "Starting server.."
|
|
|
|
echo "Starting server.."
|
|
|
|
sh /opt/emqx/bin/emqx foreground
|
|
|
|
sh /opt/emqx/bin/emqx foreground
|
|
|
|