# Load configurations from the config file if it exists
if [[ -f "$CONFIG_FILE" ]]; then
source "$CONFIG_FILE"
fi
# use default values if not overriden by config file
DB=${DB:-$DEFAULT_DB}
DB_TYPE=${DB_TYPE:-$DEFAULT_DB_TYPE}
MYSQL_HOST=${MYSQL_HOST:-$DEFAULT_MYSQL_HOST}
MYSQL_USER=${MYSQL_USER:-$DEFAULT_MYSQL_USER}
MYSQL_PASS=${MYSQL_PASS:-$DEFAULT_MYSQL_PASS}
MYSQL_DB=${MYSQL_DB:-$DEFAULT_MYSQL_DB}
###
# DB queries
db_stats_conferences_template="SELECT * FROM conferences;"
db_stats_participants_template="SELECT * FROM participants;"
help="Usage:\n\t$0 [OPTION]\nOptions:\n\t--conferences|-c - show conference stats\n\t--participants|-p - show participants stats\n\t--time|-t - show stats for a time interval"
###
# First we check for requirements
check_requirements() {
# required programs, anything non-bash - edit as needed
# deb packages - sqlite3
local required_programs=("sqlite3")
local requirements_missing=''
for program in "${required_programs[@]}"; do
if ! command -v "$program" &> /dev/null; then
requirements_missing+="$program, "
fi
done
if [[ "$requirements_missing" != '' ]]; then
requirements_missing=${requirements_missing::-2}
echo "Error: $requirements_missing - not found. Please install to proceed."