#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
set -e
# ==============================================================================
# Home Assistant Community Add-on: portainer_agent
# Runs some initializations for portainer_agent
# ==============================================================================

bashio::require.unprotected

bashio::log.info "Starting app"

# Launch app
cd /app || true
if bashio::config.has_value 'PORTAINER_AGENT_ARGS'; then
    ./agent "$PORTAINER_AGENT_ARGS" 2> /dev/null
else
    ./agent
fi
