#!/bin/bash

# This script is called if a default config
# is needed, e.g. if the 'check' script failed

# Get the necessary file paths variables from 'paths.sh'
source "custom/paths.sh"

# Delete the current configuration file
rm -f "${JSON_CONFIG_PATH}"

# Copy the default version to the folder of the config file
cp "${DEFAULT_PATH}" "${JSON_CONFIG_PATH}"

exit_code="${?}"

if [ "${exit_code}" -ne 0 ]; then
    setman-log error "'${JSON_CONFIG_FILE}' restore to default failed"
fi

exit "${exit_code}"
