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

export CP_COMPONENT_NAME=prometheus
export CP_COMPONENT_SCRIPT_DIR=/opt/confluentinc/etc/${CP_COMPONENT_NAME}

export LOG_PATH=/mnt/data/data0/logs/prometheus
# align this path with the one in the prometheus config file
# pkg/config/controlcenter/templates/dependencies/prometheus.tmpl
export CONFIG_PATH=/mnt/data/data0/config/prometheus
export TSDB_PATH=/mnt/data/prometheus-data/data/prometheus

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
