-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstall-bruno
More file actions
executable file
·31 lines (26 loc) · 1.09 KB
/
install-bruno
File metadata and controls
executable file
·31 lines (26 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
#ddev-generated
#annertech-ddev
## Description: Prepare bruno configuration
## Usage: install-bruno
## Example: "ddev install-bruno"
GLOBAL_CONF=~/.ddev/global_config.yaml
SERVICES=.platform/services.yaml
MAIN_BRANCH=main
if git show-ref --verify --quiet refs/heads/master; then
MAIN_BRANCH=master
fi
DEV_URL=$(platform url -1 -e dev)
LIVE_URL=$(platform url -1 -e $MAIN_BRANCH)
# Escape special characters for sed and ensure no trailing slashes
ESCAPED_DEV_URL=$(echo "$DEV_URL" | sed -e 's/[&/\]/\\&/g') # Escape
ESCAPED_LIVE_URL=$(echo "$LIVE_URL" | sed -e 's/[&/\]/\\&/g') # Escape
# Remove the trailing slash if it exists (after escaping)
ESCAPED_DEV_URL=$(echo "$ESCAPED_DEV_URL" | sed -e 's/\\\/$//')
ESCAPED_LIVE_URL=$(echo "$ESCAPED_LIVE_URL" | sed -e 's/\\\/$//')
# Adding Bruno
cp -r .ddev/scripts/varnish/bruno tests/
find tests/bruno -name '*.bru' -exec sed -i '/^#ddev-generated$/d' {} +
# Replace URLs in the relevant files
sed -i "s/DEV_URL/$ESCAPED_DEV_URL/g" tests/bruno/environments/Dev.bru
sed -i "s/LIVE_URL/$ESCAPED_LIVE_URL/g" tests/bruno/environments/Live.bru