#!/usr/bin/with-contenv bashio
set -e

# L'environnement est déjà initialisé par cont-init.d
bashio::log.info "=== Démarrage du service CookCLI ==="

RECIPES_PATH=$(bashio::config 'recipes_path')
PORT=9081
LOG_LEVEL=$(bashio::config 'log_level')

exec /usr/local/bin/cook server "${RECIPES_PATH}" \
    --port "${PORT}" \
    --host "0.0.0.0" \
    >> /proc/1/fd/1 2>&1