Created
May 29, 2018 16:02
-
-
Save hanoii/d787053f5c7874226ecb6173d423000f to your computer and use it in GitHub Desktop.
Platform app yaml for the wordpress example allowing to update database on sync/branch through wp-cli
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
# Only the necessary entries are on this file. | |
# IT IS NOT A COMPLETE .platform.app.yaml FILE. | |
# The mounts that will be performed when the package is deployed. | |
mounts: | |
"/deploy": "shared:files/deploy" | |
hooks: | |
deploy: | | |
DEPLOY_FILE=/app/deploy/deploy.url | |
CURRENT=`echo "import sys\nimport os\nimport json\nroutes=json.loads(os.environ['PLATFORM_ROUTES'].decode('base64'))\nfor i in routes:\n\tif routes[i]['type'] == 'upstream' and routes[i]['upstream'] == os.environ['PLATFORM_APPLICATION_NAME']: sys.stdout.write(i.strip('/'))" | python` | |
PREVIOUS=`[ -f $DEPLOY_FILE ] && cat $DEPLOY_FILE` | |
echo | |
if [ "$CURRENT" != "$PREVIOUS" ]; then | |
wp search-replace $PREVIOUS $CURRENT --skip-columns=guid | |
fi | |
echo $CURRENT > $DEPLOY_FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment