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

# Set component name and directories
export CP_COMPONENT_NAME=usm-agent
export CP_COMPONENT_SCRIPT_DIR=/opt/confluentinc/etc/${CP_COMPONENT_NAME}
export USMAGENT_CONFIG_DIR=/mnt/config

# Load operator scripts
export OPERATOR_SCRIPT_DIR=/mnt/config/${CP_COMPONENT_NAME}
echo "===> Load ${CP_COMPONENT_NAME} operator scripts from path ${OPERATOR_SCRIPT_DIR}/bin"

"${OPERATOR_SCRIPT_DIR}"/bin/configure
# Execute launch script
exec "${OPERATOR_SCRIPT_DIR}"/bin/launch
