Skip to content

Commit 0991748

Browse files
committed
Inserting consumer key and callback url from env in bootconfig.json of sample apps
1 parent 2701303 commit 0991748

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

install.sh

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1111
cd "$SCRIPT_DIR"
1212
git submodule init
1313
git submodule sync
14-
git submodule update --init --recursive
14+
git submodule update
15+
16+
# Restore bootconfig.json in shared submodule to committed placeholders
17+
git -C external/shared checkout -- samples/mobilesyncexplorer/bootconfig.json samples/accounteditor/bootconfig.json 2>/dev/null || true
1518

1619
# Create test_credentials.json if needed to avoid build errors
1720
if [ ! -f "shared/test/test_credentials.json" ]
@@ -20,6 +23,29 @@ then
2023
fi
2124

2225
# Prepare cordova.js
23-
cd external/cordova
26+
pushd "external/cordova"
2427
npm install
2528
npm run prepare
29+
popd
30+
31+
# Substitute env vars if set in bootconfig.json
32+
BOOTCONFIG_JSON_PATHS=(
33+
"external/shared/samples/mobilesyncexplorer/bootconfig.json"
34+
"external/shared/samples/accounteditor/bootconfig.json"
35+
)
36+
for bootconfig in "${BOOTCONFIG_JSON_PATHS[@]}"; do
37+
if [ -n "${MSDK_IOS_REMOTE_ACCESS_CONSUMER_KEY:-}" ]; then
38+
gsed -i "s|__CONSUMER_KEY__|${MSDK_IOS_REMOTE_ACCESS_CONSUMER_KEY}|g" "$bootconfig"
39+
fi
40+
if [ -n "${MSDK_IOS_REMOTE_ACCESS_CALLBACK_URL:-}" ]; then
41+
gsed -i "s|__REDIRECT_URI__|${MSDK_IOS_REMOTE_ACCESS_CALLBACK_URL}|g" "$bootconfig"
42+
fi
43+
done
44+
45+
if [ -z "${MSDK_IOS_REMOTE_ACCESS_CONSUMER_KEY:-}" ] || [ -z "${MSDK_IOS_REMOTE_ACCESS_CALLBACK_URL:-}" ]; then
46+
echo ""
47+
echo "Note: MSDK_IOS_REMOTE_ACCESS_CONSUMER_KEY and/or MSDK_IOS_REMOTE_ACCESS_CALLBACK_URL are not set."
48+
echo "To run the sample applications, define these environment variables or ensure bootconfig.json"
49+
echo "files have remoteAccessConsumerKey and oauthRedirectURI set."
50+
echo ""
51+
fi

0 commit comments

Comments
 (0)