Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions scripts/load.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
#!/usr/bin/env bash

FAILURE_COLOR="\033[1;31m"
NO_COLOR="\033[0m"
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
SUCCESS_COLOR="\033[1;32m"
TEXT_COLOR="\033[1;34m"
NO_COLOR="\033[0m"

SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)

if [ -z "$CONFIG_FILE" ]; then
echo -e "${FAILURE_COLOR}CONFIG_FILE is not set. Please set the CONFIG_FILE environment variable.${NO_COLOR}"
exit 1
fi

echo "Config file: $CONFIG_FILE"

echo -e "${TEXT_COLOR}Importing records${NO_COLOR}"
echo -e "${TEXT_COLOR}Importing records...${NO_COLOR}"
/opt/cmr/bin/importer import --config "$CONFIG_FILE"

exit_code=$?
if [ $exit_code -ne 0 ]; then
echo -e "${FAILURE_COLOR}Import failed with code $exit_code"
echo -e "${FAILURE_COLOR}Import failed with code $exit_code${NO_COLOR}"
exit $exit_code
fi

Expand Down