#!/usr/bin/env bash
# Copyright 2023 dinosdev.cn.
# SPDX-License-Identifier: Apache-2.0

# use POSIX interface, symlink is followed automatically
BIN_PATH="${BASH_SOURCE-$0}"
BIN_DIR="$(dirname "${BIN_PATH}")"
APP_DIR="$(cd "${BIN_DIR}/.."; pwd)"

if [[ -z $APP_LOG_DIR ]]; then
  export APP_LOG_DIR="@app.logDir@"
fi

if [[ -z $MEMORY_SIZE ]]; then
  export MEMORY_SIZE="@app.memorySize@"
fi

export APP_JAVA_OPTS="-Dspring.profiles.active=@spring.profiles.active@"

export MAIN_CLASS="@app.mainClass@"

sh $APP_DIR/bin/app.sh start @app.name@