#!/usr/bin/env sh
set -eu

: "${RPKI_RTR_ENABLE_TLS:=false}"
: "${RPKI_RTR_TCP_ADDR:=0.0.0.0:323}"
export RPKI_RTR_ENABLE_TLS
export RPKI_RTR_TCP_ADDR

: "${RPKI_RTR_DB_PATH:=./rtr-db}"
: "${RPKI_RTR_CCR_DIR:=./data}"
export RPKI_RTR_DB_PATH
export RPKI_RTR_CCR_DIR

: "${RPKI_RTR_MAX_DELTA:=100}"
: "${RPKI_RTR_STRICT_CCR_VALIDATION:=false}"
: "${RPKI_RTR_SOURCE_REFRESH_INTERVAL_SECS:=300}"
: "${RPKI_RTR_TIMING_REFRESH_SECS:=3600}"
: "${RPKI_RTR_TIMING_RETRY_SECS:=600}"
: "${RPKI_RTR_TIMING_EXPIRE_SECS:=7200}"
: "${RPKI_RTR_MAX_CONNECTIONS:=512}"
: "${RPKI_RTR_NOTIFY_QUEUE_SIZE:=1024}"
export RPKI_RTR_MAX_DELTA
export RPKI_RTR_STRICT_CCR_VALIDATION
export RPKI_RTR_SOURCE_REFRESH_INTERVAL_SECS
export RPKI_RTR_TIMING_REFRESH_SECS
export RPKI_RTR_TIMING_RETRY_SECS
export RPKI_RTR_TIMING_EXPIRE_SECS
export RPKI_RTR_MAX_CONNECTIONS
export RPKI_RTR_NOTIFY_QUEUE_SIZE

: "${RPKI_RTR_TCP_KEEPALIVE_SECS:=60}"
: "${RPKI_RTR_WARN_INSECURE_TCP:=true}"
export RPKI_RTR_TCP_KEEPALIVE_SECS
export RPKI_RTR_WARN_INSECURE_TCP

cargo run
