forked from wirepas/gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-entrypoint.sh
executable file
·63 lines (49 loc) · 1.91 KB
/
docker-entrypoint.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
#!/usr/bin/env bash
# Copyright 2019 Wirepas Ltd
set -e
export WM_GW_ID
export WM_GW_MODEL
export WM_GW_VERSION
export WM_GW_IGNORED_ENDPOINTS_FILTER
export WM_GW_WHITENED_ENDPOINTS_FILTER
export WM_SERVICES_MQTT_HOSTNAME
export WM_SERVICES_MQTT_USERNAME
export WM_SERVICES_MQTT_FORCE_UNSECURE
export WM_SERVICES_MQTT_ALLOW_UNTRUSTED
export WM_GW_SINK_UART_PORT
export WM_GW_SINK_BITRATE
export WM_GW_SINK_ID
WM_GW_ID="${WM_GW_ID:-${WM_SERVICES_GATEWAY_ID}}"
WM_GW_MODEL="${WM_GW_MODEL:-${WM_SERVICES_GATEWAY_MODEL}}"
WM_GW_VERSION="${WM_GW_VERSION:-${WM_SERVICES_GATEWAY_VERSION}}"
WM_GW_IGNORED_ENDPOINTS_FILTER="${WM_GW_IGNORED_ENDPOINTS_FILTER:-${WM_SERVICES_GATEWAY_IGNORED_ENDPOINTS_FILTER}}"
WM_GW_WHITENED_ENDPOINTS_FILTER="${WM_GW_WHITENED_ENDPOINTS_FILTER:-${WM_SERVICES_GATEWAY_WHITENED_ENDPOINTS_FILTER}}"
WM_SERVICES_MQTT_HOSTNAME="${WM_SERVICES_MQTT_HOSTNAME:-${WM_SERVICES_HOST}}"
WM_SERVICES_MQTT_USERNAME="${WM_SERVICES_MQTT_USERNAME:-${WM_SERVICES_MQTT_USER}}"
WM_SERVICES_MQTT_ALLOW_UNTRUSTED="${WM_SERVICES_MQTT_ALLOW_UNTRUSTED:-${WM_SERVICES_ALLOW_UNSECURE}}"
WM_SERVICES_MQTT_FORCE_UNSECURE="${WM_SERVICES_MQTT_FORCE_UNSECURE:-${WM_SERVICES_ALLOW_UNSECURE}}"
WM_SERVICES_MQTT_CA_CERTS="${WM_SERVICES_MQTT_CA_CERTS:-${WM_SERVICES_CERTIFICATE_CHAIN}}"
WM_GW_SINK_UART_PORT="${WM_GW_SINK_UART_PORT:-${WM_SINK_UART_PORT}}"
WM_GW_SINK_BITRATE="${WM_GW_SINK_BITRATE:-${WM_SINK_UART_BITRATE}}"
WM_GW_SINK_ID="${WM_GW_SINK_ID:-${WM_SINK_ID}}"
TARGET=${1}
echo "Image source manifest"
cat "${SERVICE_HOME}/manifest"
if [[ "${TARGET}" == "sink" || "${TARGET}" == "transport" ]]
then
if [[ "${TARGET}" == "transport" ]]
then
echo "connecting to ${WM_SERVICES_HOST}"
TARGET="wm-gw"
fi
if [[ "${TARGET}" == "sink" ]]
then
TARGET="/usr/local/bin/sinkService"
fi
echo "Starting service: ${TARGET}"
#shellcheck disable=SC2086
exec ${TARGET}
else
exec "$@"
fi
echo "exiting"