This repository has been archived by the owner on Mar 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 71
/
update-config.sh
65 lines (56 loc) · 1.93 KB
/
update-config.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
#!/bin/bash
ApiUrl="${EX_ApiUrl:-}"
Html5Mode="${EX_Html5Mode:-false}"
EnableSsl="${EX_EnableSsl:-false}"
EnableAccountCreation="${EX_EnableAccountCreation:-true}"
OAuth="${EX_ConnectionStrings__OAuth:-}"
IFS=';' read -a oauthParts <<< "$OAuth"
for part in ${oauthParts[@]}
do
key="$( cut -d '=' -f 1 <<< $part )"; echo "key: $key"
value="$( cut -d '=' -f 2- <<< $part )"; echo "value: $value"
if [ "$key" == "FacebookId" ]; then
FacebookAppId=$value
fi
if [ "$key" == "GitHubId" ]; then
GitHubAppId=$value
fi
if [ "$key" == "GoogleId" ]; then
GoogleAppId=$value
fi
if [ "$key" == "IntercomId" ]; then
IntercomAppId=$value
fi
if [ "$key" == "MicrosoftId" ]; then
MicrosoftAppId=$value
fi
if [ "$key" == "SlackId" ]; then
SlackAppId=$value
fi
done
config_header="(function () {
'use strict';
angular.module('app.config', [])"
config="
.constant('BASE_URL', '$ApiUrl' || window.location.origin)
.constant('EXCEPTIONLESS_API_KEY', '$EX_ExceptionlessApiKey')
.constant('EXCEPTIONLESS_SERVER_URL', '$EX_ExceptionlessServerUrl')
.constant('FACEBOOK_APPID', '$FacebookAppId')
.constant('GITHUB_APPID', '$GitHubAppId')
.constant('GOOGLE_APPID', '$GoogleAppId')
.constant('INTERCOM_APPID', '$IntercomAppId')
.constant('LIVE_APPID', '$MicrosoftAppId')
.constant('SLACK_APPID', '$SlackAppId')
.constant('STRIPE_PUBLISHABLE_KEY', '$EX_StripePublishableApiKey')
.constant('SYSTEM_NOTIFICATION_MESSAGE', '$EX_NotificationMessage')
.constant('USE_HTML5_MODE', $Html5Mode)
.constant('USE_SSL', $EnableSsl)
.constant('ENABLE_ACCOUNT_CREATION', $EnableAccountCreation);"
config_footer="
}());"
echo "Exceptionless UI Config"
echo "$config"
checksum=`echo -n $config | md5sum | cut -c 1-32`
echo "$config_header$config$config_footer" > "app.config.$checksum.js"
CONTENT=$(cat index.html)
echo "$CONTENT" | sed -E "s/app\.config\..+\.js/app.config.$checksum.js/" > index.html