#!/bin/bash

# Copyright (C) Metaswitch Networks 2017
# If license terms are provided to you in a COPYING file in the root directory
# of the source code repository by which you are accessing this code, then
# the license outlined in that COPYING file applies to your use.
# Otherwise no rights are granted except for those provided to you by
# Metaswitch Networks in a separate written agreement.

FILENAME=bgcf.json
KEY=bgcf_json
SCHEMA=/usr/share/clearwater/clearwater-config-manager/scripts/config_validation/bgcf_schema.json

. /usr/share/clearwater/utils/check-root-permissions 1

# Pass optional argument directly to upload_json, which checks for --allow-large
# option that allows file upload larger than advisable
/usr/share/clearwater/clearwater-config-manager/scripts/upload_generic_json $FILENAME $KEY $SCHEMA $@

rc=$?
if [[ $rc == 0 ]]; then
  echo "Successfully uploaded the new BGCF configuration"
fi

exit $rc
