42 lines
1.2 KiB
Bash
42 lines
1.2 KiB
Bash
|
#!/bin/sh
|
||
|
|
||
|
cd /app
|
||
|
|
||
|
if ! [ -z "$LW_CONFIGURE" ]; then
|
||
|
if [ -z "$DB_PASSWORD_FILE" ]; then
|
||
|
password="$DB_PASSWORD"
|
||
|
else
|
||
|
password="`cat $DB_PASSWORD_FILE`"
|
||
|
fi
|
||
|
cat >data-source.xml <<EOF
|
||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||
|
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
|
||
|
<bean name="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
|
||
|
<property name="driverClassName" value="org.postgresql.Driver" />
|
||
|
<property name="url" value="jdbc:postgresql://${DB_HOST}:5432/${DB_NAME}" />
|
||
|
<property name="username" value="${DB_USER}" />
|
||
|
<property name="password" value="${password}" />
|
||
|
</bean>
|
||
|
</beans>
|
||
|
EOF
|
||
|
fi
|
||
|
|
||
|
cmd="$1"
|
||
|
shift
|
||
|
if [ "$cmd" == server ]; then
|
||
|
exec /usr/bin/java \
|
||
|
-Dlog4j.configuration=log4j.properties \
|
||
|
-jar server.jar
|
||
|
elif [ "$cmd" == shell ]; then
|
||
|
exec /bin/sh
|
||
|
elif [ "$cmd" == tool ]; then
|
||
|
exec /usr/bin/java \
|
||
|
-jar legacyworlds-server-main-*.jar \
|
||
|
--run-tool "$*"
|
||
|
else
|
||
|
echo "Invalid command '$cmd'" >&2
|
||
|
exit 1
|
||
|
fi
|