#!/usr/bin/with-contenv bashio
# ==============================================================================
# s6-overlay docs: https://github.com/just-containers/s6-overlay
# ==============================================================================

set -e

export FH_HUB_IP=$(bashio::config 'hub_ip')
export FH_USERNAME=$(bashio::config 'fh_username')
export FH_PASSWORD=$(bashio::config 'fh_password')
export TP_USERNAME=$(bashio::config 'tp_username')
export TP_PASSWORD=$(bashio::config 'tp_password')
export TP_ALLOW_EMPTY=$(bashio::config 'tp_allow_empty')
export IGNORE_AVAILABILITY_REPORTS=$(bashio::config 'ignore_availability_reports')
export DEMO_MODE=$(bashio::config 'demo_mode')
export SHOW_DEBUG_LOG=$(bashio::config 'show_debug_log')

export MQTT_HOST=$(bashio::services mqtt "host")
export MQTT_PORT=$(bashio::services mqtt "port")
export MQTT_USER=$(bashio::services mqtt "username")
export MQTT_PWD=$(bashio::services mqtt "password")

export LOG_LEVEL=${LOG_LEVEL:-info}

/usr/bin/node /usr/src/app/dist/index.js
