-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathentrypoint
executable file
·78 lines (65 loc) · 2.08 KB
/
entrypoint
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
## This file replaces the Dyalog mapl script
echo " _______ __ _ ____ _____ "
echo "| __ \ \ / //\ | | / __ \ / ____|"
echo "|_| | \ \_/ // \ | | | | | | | "
echo " | |\ // /\ \ | | | | | | | _ "
echo " ____| | | |/ / \ \| |___| |__| | |__| |"
echo "|_____/ |_/_/ \_\______\____/ \_____|"
echo ""
echo "https://www.dyalog.com"
echo ""
if [ "x${SQL_SERVER}" != "x" ]; then
MAXTIME=60
C=1
echo "Waiting for database to come up at address ${SQL_SERVER}:${SQL_PORT}..."
while [ `/bin/nc ${SQL_SERVER} ${SQL_PORT} < /dev/null > /dev/null 2>&1; echo $?` != 0 ]; do
sleep 1
let C="$C + 1"
if [ $C -gt $MAXTIME ]; then
echo "Database server failed after ${MAXTIME} seconds - Continuing..."
break;
fi
done
fi
if env | grep "^SQL*" > /dev/null 2>&1 ; then
## Set default database driver to MySQL
export SQL_DRIVER=${SQL_DRIVER:-MySQL}
export SQL_PORT=${SQL_PORT:-3309}
export SQL_DSN=${SQL_DSN:-$SQL_DATABASE}
cp /etc/odbc.ini /tmp/
cd /tmp
echo "Setting up SQAPL Connection"
env | awk -F"=" '/^SQL/ {print $1 " " $2}' | while read KEY VAL; do
sed -i "s/##${KEY}##/${VAL}/" /tmp/odbc.ini
done
cp /tmp/odbc.ini /etc/odbc.ini
rm /tmp/odbc.ini
cd -
fi
export MAXWS=${MAXWS-256M}
export DYALOG=/opt/mdyalog/18.2/64/unicode/
export WSPATH=/opt/mdyalog/18.2/64/unicode/ws
export TERM=dumb
export APL_TEXTINAPLCORE=${APL_TEXTINAPLCORE-1}
export TRACE_ON_ERROR=${TRACE_ON_ERROR-1}
export SESSION_FILE="${SESSION_FILE-$DYALOG/default.dse}"
export ODBCINI=/etc/odbc.ini
export Port=8080
if [ $(ls /app 2>/dev/null | wc -l) -gt 0 ]; then
echo "Application found in /app."
MISITE=/app
else
echo "No application found in /app. Running with sample pages"
MISITE="/MiServer/MS3"
fi
export MiServer=${MiServer-$MISITE}
if ! [ -d ${MiServer}/Logs ]; then
mkdir ${MiServer}/Logs
chmod 777 ${MiServer}/Logs
fi
if [ -n "${RIDE_INIT}" ]; then
$DYALOG/dyalog +s -q /MiServer/miserver.dws
else
$DYALOG/dyalog -s /MiServer/miserver.dws
fi