mirror of
https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder.git
synced 2024-11-22 05:40:10 +00:00
make config interpretation more robust
This commit is contained in:
parent
a287992d41
commit
fa5b7b91d0
3 changed files with 28 additions and 2 deletions
|
@ -69,6 +69,8 @@ fi
|
|||
# Strip any extraneous spaces:
|
||||
MLAT_CONFIG="${MLAT_CONFIG#"${MLAT_CONFIG%%[![:space:]]*}"}" # strip leading space
|
||||
MLAT_CONFIG="${MLAT_CONFIG//; /;}"
|
||||
# remove any newlines:
|
||||
MLAT_CONFIG="${MLAT_CONFIG//$'\n'/}"
|
||||
readarray -td ";" mlat_configs < <(printf '%s' "${MLAT_CONFIG}")
|
||||
|
||||
|
||||
|
|
|
@ -37,6 +37,11 @@ MLATHUB_CMD+=("--net-beast-reduce-out-port=${MLATHUB_BEAST_REDUCE_OUT_PORT:-3100
|
|||
|
||||
# We need to get the mlat results ports from the parameters:
|
||||
# parse MLAT_CONFIG string into mlat_configs array
|
||||
# Strip any extraneous spaces:
|
||||
MLAT_CONFIG="${MLAT_CONFIG#"${MLAT_CONFIG%%[![:space:]]*}"}" # strip leading space
|
||||
MLAT_CONFIG="${MLAT_CONFIG//; /;}"
|
||||
# remove any newlines:
|
||||
MLAT_CONFIG="${MLAT_CONFIG//$'\n'/}"
|
||||
readarray -td ";" mlat_configs < <(printf '%s' "${MLAT_CONFIG// /}")
|
||||
# Now loop through the MLAT_CONFIG items and add a net-connector for each of them:
|
||||
mlat_result_sources=0
|
||||
|
|
|
@ -56,6 +56,8 @@
|
|||
# Do some prep work:
|
||||
# combine ULTRAFEEDER_CONFIG and ULTRAFEEDER_NET_CONNECTOR
|
||||
ULTRAFEEDER_CONFIG="${ULTRAFEEDER_CONFIG}${ULTRAFEEDER_CONFIG:+;}${ULTRAFEEDER_NET_CONNECTOR}"
|
||||
# remove any newlines:
|
||||
ULTRAFEEDER_CONFIG="${ULTRAFEEDER_CONFIG//$'\n'/}"
|
||||
# Strip any extraneous spaces:
|
||||
ULTRAFEEDER_CONFIG="${ULTRAFEEDER_CONFIG#"${ULTRAFEEDER_CONFIG%%[![:space:]]*}"}" # strip leading space
|
||||
ULTRAFEEDER_CONFIG="${ULTRAFEEDER_CONFIG//; /;}"
|
||||
|
@ -120,8 +122,25 @@ do
|
|||
;;
|
||||
|
||||
*)
|
||||
# unknown string; warn and skip
|
||||
# Check if there's anything in ${ULTRAFEEDER_NET_CONNECTOR} -- if not, it's a bad config element. If yes, add it as if it were ADSB
|
||||
if [[ -z "${ULTRAFEEDER_NET_CONNECTOR}" ]]; then
|
||||
echo "[$(date)][${APPNAME}] Warning: skipping unknown ULTRAFEEDER_CONFIG config element \"${instance}\""
|
||||
else
|
||||
# parse arguments for main readsb
|
||||
# build net-connector string into $readsb_str
|
||||
# and add any extra arguments in as individual entries into READSB_CONF_ARR()
|
||||
readsb_str="${param[0]},${param[1]},${param[2]}"
|
||||
for ((i=3; i<${#param[*]}; i++))
|
||||
do
|
||||
if [[ "${param[i]:0:5}" == "uuid=" ]]; then
|
||||
readsb_str="${readsb_str},${param[i]}"
|
||||
elif [[ -n "${param[i]}" ]]; then
|
||||
READSB_CONF_ARR+=("${param[i]}")
|
||||
fi
|
||||
done
|
||||
# Now add $readsb_str to the READSB_CONF_ARR() as --net-connector argument:
|
||||
READSB_CONF_ARR+=("--net-connector=${readsb_str}")
|
||||
fi
|
||||
esac
|
||||
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue