-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #10 Use `bootstrap.sh` to manage API key with a two step build process.
- Loading branch information
Showing
4 changed files
with
46 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
XML_FILE="./config/onebusaway-api-webapp-data-sources.xml" | ||
NAMESPACE_PREFIX="x" | ||
NAMESPACE_URI="http://www.springframework.org/schema/beans" | ||
BEAN_ID="testAPIKey" | ||
|
||
# Check if the TEST_API_KEY environment variable is set | ||
if [ -n "$TEST_API_KEY" ]; then | ||
# If it is set, then add the API key to the data-sources.xml file | ||
echo "TEST_API_KEY set to $TEST_API_KEY, setting API key in data-sources.xml" | ||
xmlstarlet ed -L -N ${NAMESPACE_PREFIX}=${NAMESPACE_URI} \ | ||
-s "//${NAMESPACE_PREFIX}:bean[@id='${BEAN_ID}']" -t elem -n "property" -v "" \ | ||
-i "//${NAMESPACE_PREFIX}:bean[@id='${BEAN_ID}']/property[not(@name)]" -t attr -n "name" -v "key" \ | ||
-i "//${NAMESPACE_PREFIX}:bean[@id='${BEAN_ID}']/property[@name='key']" -t attr -n "value" -v "${TEST_API_KEY}" \ | ||
${XML_FILE} | ||
else | ||
# If it is not set, then remove the element from the data-sources.xml file | ||
echo "TEST_API_KEY environment variable is not set. Removing element from data-sources.xml" | ||
xmlstarlet ed -L -N ${NAMESPACE_PREFIX}=${NAMESPACE_URI} \ | ||
-d "//${NAMESPACE_PREFIX}:bean[@id='${BEAN_ID}']" \ | ||
${XML_FILE} | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters