#! /bin/bash set -eu if [[ $# -eq 1 ]]; then BUCKET_NAME="$1" else BUCKET_NAME=$(jq < cfn-output.json -er '.SiteBucket') fi API_ENDPOINT=$(jq < cfn-output.json -er '.LoadBalancerDNS') # For auth, not used now #USER_POOL_ID=$(jq < cfn-output.json -er '.UserPoolId') #CLIENT_ID=$(jq < cfn-output.json -er '.ClientId') REGION=$(aws configure get region) TEMP_DIR=$(mktemp -d) cp -R web/. $TEMP_DIR/. if which gsed; then sed_cmd=gsed else sed_cmd=sed fi sed_prog="s|REPLACE_ME_API_ENDPOINT|http://$API_ENDPOINT|;" $sed_cmd -i $sed_prog $TEMP_DIR/index.html $sed_cmd -i $sed_prog $TEMP_DIR/register.html $sed_cmd -i $sed_prog $TEMP_DIR/confirm.html aws s3 sync $TEMP_DIR s3://$BUCKET_NAME --acl public-read