Skip to content

Commit

Permalink
Fix clear cache command for live domains
Browse files Browse the repository at this point in the history
  • Loading branch information
sippsolutions committed Oct 22, 2024
1 parent a0de034 commit 3e5fd5e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
1 change: 1 addition & 0 deletions GOLIVE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ are created for www and root
- IT of customer needs to create CNAME-record for www. to `cdn.adobeaemcloud.com` (this is the go-live!)
- Change `cdn.live.host` in `.helix/config.xlsx` to `www.domain.com`
- Change `tenants` live domains in `tenants.js`
- Add domain to replacement URLs list in `bin/clear-cache`
23 changes: 21 additions & 2 deletions bin/clear-cache
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,28 @@ if [ -z "$1" ]; then
exit 1
fi

# extract parts from the input URL
# get input url
INPUT_URL=$1
PATTERN='https:\/\/([a-zA-Z0-9-]+)--([a-zA-Z0-9-]+)--([a-zA-Z0-9-]+)\.hlx\.([a-zA-Z]+)/(.*)'

# replace live domains
ORIGINAL_URLS=(
"https://www.eder-gmbh.de"
"https://www.eder-landtechnik.de"
"https://www.agratec-salching.de"
)
REPLACEMENT_URLS=(
"https://main--eds-eder-gmbh--techdivision.aem.live"
"https://main--eds-eder-landtechnik--techdivision.aem.live"
"https://main--eds-agratec-salching--techdivision.aem.live"
)

# loop through the original URLs and replace them
for i in "${!ORIGINAL_URLS[@]}"; do
INPUT_URL="${INPUT_URL//${ORIGINAL_URLS[i]}/${REPLACEMENT_URLS[i]}}"
done

# extract parts from the input URL
PATTERN='https:\/\/([a-zA-Z0-9-]+)--([a-zA-Z0-9-]+)--([a-zA-Z0-9-]+)\.aem\.([a-zA-Z]+)/(.*)'

# check if URL matches the pattern
if [[ $INPUT_URL =~ $PATTERN ]]; then
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3e5fd5e

Please sign in to comment.