Skip to content

Commit 2d3fc5b

Browse files
authored
Merge pull request #161 from HyperloopUPV-H8/backend/load-secret-fix
[Backend] Fix the logic of the secret loader script
2 parents 27ed4f6 + 0a8a568 commit 2d3fc5b

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

backend/load-secret.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
1+
#!/bin/bash
2+
3+
# Check if exactly one argument is passed
14
if [ $# -ne 1 ]; then
2-
echo "expected at least one argument";
3-
exit 1;
5+
echo "Error: expected exactly one argument (path to 'secret.json')."
6+
exit 1
7+
fi
8+
9+
# Check if the 'secret.json' file exists
10+
if [ ! -f "$1" ]; then
11+
echo "Error: 'secret.json' file not found at '$1'."
12+
exit 1
413
fi
514

6-
echo "$1" > "./internal/excel/secret.json"
7-
echo "$1" > "./internal/excel_adapter/internals/secret.json"
8-
echo "$1" > "./pkg/excel/secret.json"
9-
echo "$1" > "./pkg/excel_adapter/internals/secret.json"
15+
# Copy the 'secret.json' file to the specified directories
16+
cp "$1" "./internal/excel/secret.json" || { echo "Failed to copy to ./internal/excel/"; exit 1; }
17+
cp "$1" "./internal/excel_adapter/internals/secret.json" || { echo "Failed to copy to ./internal/excel_adapter/internals/"; exit 1; }
18+
cp "$1" "./pkg/excel/secret.json" || { echo "Failed to copy to ./pkg/excel/"; exit 1; }
19+
cp "$1" "./pkg/excel_adapter/internals/secret.json" || { echo "Failed to copy to ./pkg/excel_adapter/internals/"; exit 1; }
20+
21+
echo "'secret.json' successfully copied to all specified directories."

0 commit comments

Comments
 (0)