-
Notifications
You must be signed in to change notification settings - Fork 45
/
entrypoint-driver.sh
executable file
·69 lines (52 loc) · 2.14 KB
/
entrypoint-driver.sh
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
#!/bin/sh
DRIVER_CONFIG_TEMPLATE=${DRIVER_CONFIG_TEMPLATE:-$(pwd)/config/driver.template.toml}
# We need to export this variable because it needs to be visible
# by the dummy driver executable which is required to locate the
# configuration.
#
DRIVER_CONFIG=${DRIVER_CONFIG:-$(pwd)/config/driver.toml}
BINARY="$(pwd)/dummy-driver"
RELAY_PORT=${RELAY_PORT:-9080}
RELAY_NAME=${RELAY_NAME:-Relay}
RELAY_HOST=${RELAY_HOST:-relay-server}
DRIVER_PORT=${DRIVER_PORT:-9081}
DRIVER_NAME=${DRIVER_NAME:-DummyDriver}
NETWORK_NAME=${NETWORK_NAME:-dummy}
source $(pwd)/init.sh
echo "Relay Dummy Driver"
echo "-----------------------------------------"
echo " 1. Running Pre-flight Checks..."
echo " - Working Directory: : $(pwd)"
echo " - DRIVER_CONFIG : ${DRIVER_CONFIG}"
write_fingerprint
echo ""
echo " 2. Preparing Configuration...."
if [ ! -f "${DRIVER_CONFIG}" ]; then
echo " - Driver Configuration Missing, generating from template: "
echo " - checking DRIVER_NAME : ${DRIVER_NAME}"
echo " - checking DRIVER_PORT : ${DRIVER_PORT}"
echo " - checking RELAY_NAME : ${RELAY_NAME}"
echo " - checking RELAY_PORT : ${RELAY_PORT}"
echo " - checking RELAY_HOST : ${RELAY_HOST}"
echo " - checking NETWORK_NAME : ${NETWORK_NAME}"
echo " - checking DRIVER_CONFIG_TEMPLATE : ${DRIVER_CONFIG_TEMPLATE}"
require_file ${DRIVER_CONFIG_TEMPLATE} 1
echo " - generating driver configuration ${DRIVER_CONFIG_TEMPLATE} => ${DRIVER_CONFIG}..."
specialise_file ${DRIVER_CONFIG_TEMPLATE} ${DRIVER_CONFIG}
else
echo " - Detected Driver Configuration ${DRIVER_CONFIG}.."
fi
echo ""
debug " - Current Configuration"
debug_cat ${DRIVER_CONFIG}
echo " 2. Starting Dummy Driver ...."
echo " - Executable : ${BINARY}"
echo " - Runtime Arguments : $@"
echo""
require_file ${DRIVER_CONFIG} 2
require_file ${BINARY} 3
# Currently the same environment variable is used for
# both the relay server and the driver even though the
# configuration is a different subset.
#
RELAY_CONFIG=${DRIVER_CONFIG} ${BINARY} $@