#!/bin/bash
set -u

source "$(dirname "$0")"/custom/common.sh

if [ ! -f "${FIREWALL_CFG_FILE}" ]; then
	exit 0
fi

firewall_services=$(jq -r '.services' <"${FIREWALL_CFG_FILE}")
if [ $? -ne 0 ] || [ "${firewall_services}" == "null" ]; then
	setman-log error "firewall/dynamic-config config file does not contain services array: ${FIREWALL_CFG_FILE}"
	exit 1
fi

setman-log debug "firewall/dynamic-config config file valid: ${FIREWALL_CFG_FILE}"

exit 0
