#!/bin/sh

# https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/dev/build/tasks/bin/scripts/opensearch-dashboards-plugin

DIR="/usr/share/opensearch-dashboards"
CONFIG_DIR="/etc/opensearch-dashboards"

if [ -f "${CONFIG_DIR}/node.options" ]; then
    OSD_NODE_OPTS="$(grep -v ^# <${CONFIG_DIR}/node.options | xargs)"
fi

NODE_OPTIONS="--no-warnings $OSD_NODE_OPTS $NODE_OPTIONS" NODE_ENV=production exec node "${DIR}/src/cli_plugin/dist" ${@}
