#!/usr/bin/env bash
#
# Copyright 2020 Confluent Inc.
#
set -o nounset
set -o errexit

export CP_COMPONENT_NAME=alertmanager
export CP_COMPONENT_SCRIPT_DIR=/opt/confluentinc/etc/${CP_COMPONENT_NAME}
export LOG_PATH=/mnt/data/data0/logs/alertmanager
# align this path with the one in the prometheus config file
# pkg/config/controlcenter/templates/dependencies/alertmanager.tmpl
export CONFIG_PATH=/mnt/data/data0/config/alertmanager
export DATA_PATH=/mnt/data/data0/data/alertmanager

echo "===> User: $(id)"
export OPERATOR_SCRIPT_DIR=/mnt/config/${CP_COMPONENT_NAME}
echo "===> Loading ${CP_COMPONENT_NAME} operator scripts from path ${OPERATOR_SCRIPT_DIR}/bin"

"${OPERATOR_SCRIPT_DIR}"/bin/configure
exec "${OPERATOR_SCRIPT_DIR}"/bin/launch
