#!/bin/bash

set -eu

source custom/paths.sh

if [ ! -f "${dynamic_config_path}" ]; then
   setman-log error "Dynamic config was not found!"
   echo 2
fi


 jq \
        ' 
        .ports[]
        | if (has("name")) then 
                . 
            else
                "Missing \"name\" key" | halt_error(1)
            end 
        | if (.name|type=="string") then 
                . 
            else 
                "The \"name\" key value must be of type string." | halt_error(1)
            end
        ' \
    "${dynamic_config_path}" 1> /dev/null


#if jq has error, this will never run
