From 0a8a5681463157b98b8432fdffbe760f201a059c Mon Sep 17 00:00:00 2001 From: msanlli Date: Thu, 24 Oct 2024 18:39:59 +0200 Subject: [PATCH] fix load secret --- backend/load-secret.sh | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/backend/load-secret.sh b/backend/load-secret.sh index 105c658e3..80859c996 100755 --- a/backend/load-secret.sh +++ b/backend/load-secret.sh @@ -1,9 +1,21 @@ +#!/bin/bash + +# Check if exactly one argument is passed if [ $# -ne 1 ]; then - echo "expected at least one argument"; - exit 1; + echo "Error: expected exactly one argument (path to 'secret.json')." + exit 1 +fi + +# Check if the 'secret.json' file exists +if [ ! -f "$1" ]; then + echo "Error: 'secret.json' file not found at '$1'." + exit 1 fi -echo "$1" > "./internal/excel/secret.json" -echo "$1" > "./internal/excel_adapter/internals/secret.json" -echo "$1" > "./pkg/excel/secret.json" -echo "$1" > "./pkg/excel_adapter/internals/secret.json" +# Copy the 'secret.json' file to the specified directories +cp "$1" "./internal/excel/secret.json" || { echo "Failed to copy to ./internal/excel/"; exit 1; } +cp "$1" "./internal/excel_adapter/internals/secret.json" || { echo "Failed to copy to ./internal/excel_adapter/internals/"; exit 1; } +cp "$1" "./pkg/excel/secret.json" || { echo "Failed to copy to ./pkg/excel/"; exit 1; } +cp "$1" "./pkg/excel_adapter/internals/secret.json" || { echo "Failed to copy to ./pkg/excel_adapter/internals/"; exit 1; } + +echo "'secret.json' successfully copied to all specified directories."