diff --git a/api/cred_data/blueprint.py b/api/cred_data/blueprint.py index e5a705f..ef15906 100644 --- a/api/cred_data/blueprint.py +++ b/api/cred_data/blueprint.py @@ -241,7 +241,8 @@ async def get_data( # Successfully retrieved: return ResponseModel( status_code = StatusCodes.OK, - data = cred_json["content"] + data = cred_json["content"], + message = cred_json["desc"] ) diff --git a/rsync_dir.sh b/rsync_dir.sh new file mode 100644 index 0000000..b8ad8b6 --- /dev/null +++ b/rsync_dir.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# A quick command to copy sensitive files from development machine to server without involvement of GitHub: + +# Read the servers from the file into an array: +mapfile -t SERVERS < servers.txt + +# Display the numbered list of server options: +echo "Please select a server:" +for i in "${!SERVERS[@]}"; do + echo "$((i + 1)). ${SERVERS[i]}" +done + +# Prompt the user for their selection +read -rp "Select a server by the number ... : " SELECTION + +# Validate the selection +if [[ $SELECTION -gt 0 && $SELECTION -le ${#SERVERS[@]} ]]; then + + # Note down the selection in a variable: + SELECTED_SERVER=${SERVERS[$((SELECTION - 1))]} + + # Ask the user which directory he wants to upload and his username on the server: + read -rp "Your username on the server ..... : " USER + read -rp "Directory to send ............... : " SOURCE + + # Run the rsync command: + PROJECT_DIRECTORY=$(basename "$PWD") + DESTINATION="$USER@$SELECTED_SERVER://home/$USER/programming/python/$PROJECT_DIRECTORY" + echo "Trying to send '$SOURCE' to '$DESTINATION'" + rsync -avz --mkpath --progress -e "ssh -p 19991" "$SOURCE" "$DESTINATION" + + # Exit with success (assuming that the actual data sending went well): + exit 0 + +else + + # In case of a wrong server selection, exit with failure. + echo "Invalid selection. Please run the script again." + exit 1 + +fi diff --git a/setup.sh b/setup.sh index 3c14ed1..d348c15 100644 --- a/setup.sh +++ b/setup.sh @@ -1,7 +1,7 @@ # We create a Virtual Environment. # The format is: # python -m venv -echo "Making a virtual environment (if needed)" +echo "Making a virtual environment (if needed)." python3 -m venv .venv # Next we activate the newly created Virtual Environment.