Skip to content

Commit 6d5dad4

Browse files
committed
checking if repo exist
1 parent 9302373 commit 6d5dad4

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed
Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
#!/bin/bash
22

3-
# Define the path to the JavaScript file
4-
JS_FILE="/home/splunk/spring-petclinic-microservices/spring-petclinic-api-gateway/src/main/resources/static/scripts/env.js"
3+
# Define the path to the repository directory
4+
REPO_DIR="/home/splunk/spring-petclinic-microservices"
55

6-
# Create the directory if it doesn't exist
7-
mkdir -p "$(dirname "$JS_FILE")"
6+
# Check if the repository directory exists
7+
if [ -d "$REPO_DIR" ]; then
8+
echo "Repository directory exists."
9+
# Define the path to the JavaScript file
10+
JS_FILE="$REPO_DIR/spring-petclinic-api-gateway/src/main/resources/static/scripts/env.js"
811

9-
# Write the content to the JavaScript file
10-
cat <<EOF > "$JS_FILE"
12+
# Create the directory if it doesn't exist
13+
mkdir -p "$(dirname "$JS_FILE")"
14+
15+
# Write the content to the JavaScript file
16+
cat <<EOF > "$JS_FILE"
1117
env = {
1218
RUM_REALM: '$RUM_REALM',
1319
RUM_AUTH: '$RUM_AUTH',
@@ -16,4 +22,7 @@ env = {
1622
}
1723
EOF
1824

19-
echo "JavaScript file generated at: $JS_FILE"
25+
echo "JavaScript file generated at: $JS_FILE"
26+
else
27+
echo "Error: Repository directory does not exist."
28+
fi

0 commit comments

Comments
 (0)