-
Notifications
You must be signed in to change notification settings - Fork 41
/
entrypoint.sh
executable file
·66 lines (57 loc) · 1.95 KB
/
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
63
64
65
66
#!/bin/sh
set -e -x
# Uses following env variables:
# * GATEWAY_IP - address of the API gateway
# * GATEWAY_PORT - gateway port, defaults to no specified port
# * DEMO [true/false] - switch for demo UI, defaults to false.
# * INTEGRATION_VERSION - version of integration service, to be displayed in UI
# * ANNOUNCEMENT - announcement to display in Hosted Mender UI
HOSTNAME=""
if [ -n "$GATEWAY_IP" ]; then
HOSTNAME=$GATEWAY_IP
fi
if [ -n "$GATEWAY_PORT" ]; then
HOSTNAME=$HOSTNAME':'$GATEWAY_PORT
fi
if [ -n "$STRIPE_API_KEY" ]; then
wget -O /var/www/mender-gui/dist/tags.json https://api.github.com/repos/mendersoftware/gui/tags?per_page=10
else
echo "[]" >> /var/www/mender-gui/dist/tags.json
fi
cat >/var/www/mender-gui/dist/env.js <<EOF
mender_environment = {
hostAddress: "$HOSTNAME",
hostedAnnouncement: "$ANNOUNCEMENT",
isDemoMode: "$DEMO",
features: {
hasAuditlogs: "$HAVE_AUDITLOGS",
hasDeviceConfig: "$HAVE_DEVICECONFIG",
hasDeviceConnect: "$HAVE_DEVICECONNECT",
hasDeltaProgress: "$HAVE_DELTA_PROGRESS",
hasMonitor: "$HAVE_MONITOR",
hasMultitenancy: "$HAVE_MULTITENANT",
hasReleaseTags: "$HAVE_RELEASE_TAGS",
hasReporting: "$HAVE_REPORTING",
isEnterprise: "$HAVE_ENTERPRISE"
},
trackerCode: "$TRACKER_CODE",
recaptchaSiteKey: "$RECAPTCHA_SITE_KEY",
stripeAPIKey: "$STRIPE_API_KEY",
integrationVersion: "$INTEGRATION_VERSION",
menderVersion: "$MENDER_VERSION",
menderArtifactVersion: "$MENDER_ARTIFACT_VERSION",
metaMenderVersion: "$META_MENDER_VERSION",
services: {
deploymentsVersion: "$MENDER_DEPLOYMENTS_VERSION",
deviceauthVersion: "$MENDER_DEVICEAUTH_VERSION",
guiVersion: "${GIT_COMMIT_TAG:-local_local}",
inventoryVersion: "$MENDER_INVENTORY_VERSION"
},
demoArtifactPort: "$DEMO_ARTIFACT_PORT",
disableOnboarding: "$DISABLE_ONBOARDING"
}
EOF
if [ "$1" = 'nginx' ]; then
exec nginx -g 'daemon off;'
fi
exec "$@"