api/scripts/docker/entrypoint.sh

30 lines
1.5 KiB
Bash

#!/bin/sh
SPRING_CUSTOM_CONFIG=""
################################################## active config start #################################################
if [ "${SPRING_PROFILE_ACTIVE}" ];then
SPRING_CUSTOM_CONFIG="${SPRING_CUSTOM_CONFIG} -Dspring.profiles.active='$SPRING_PROFILE_ACTIVE'"
else
SPRING_CUSTOM_CONFIG="${SPRING_CUSTOM_CONFIG} -Dspring.profiles.active='docker'"
fi
################################################## active config end ###################################################
################################################## spring config location start ########################################
if [ "${SPRING_CONFIG_LOCATION}" ];then
SPRING_CUSTOM_CONFIG="${SPRING_CUSTOM_CONFIG} -Dspring.config.additional-location='$SPRING_CONFIG_LOCATION'"
else
SPRING_CUSTOM_CONFIG="${SPRING_CUSTOM_CONFIG} -Dspring.config.additional-location='/app/conf/'"
fi
################################################## spring config location end #########################################
################################################## timezone config start #################################################
if [ "${SPRING_USER_TIMEZONE}" ];then
SPRING_CUSTOM_CONFIG="${SPRING_CUSTOM_CONFIG} -Duser.timezone='$SPRING_USER_TIMEZONE'"
else
SPRING_CUSTOM_CONFIG="${SPRING_CUSTOM_CONFIG} -Duser.timezone='GMT+08'"
fi
################################################## timezone config end ###################################################
sh -c "java -server ${SPRING_CUSTOM_CONFIG} ${SPRING_OPTS} ${JAVA_OPTS} -jar /app/app.jar"