#!/bin/bash
# clnstrt entrypoint for azure-functions-node.
# Mirrors the env Microsoft sets in their `func init --docker` generated
# Dockerfile (AzureWebJobsScriptRoot, AzureFunctionsJobHost__Logging__...),
# then execs the self-contained host binary directly (no dotnet muxer needed
# since we publish --self-contained).

set -euo pipefail

: "${AzureWebJobsScriptRoot:=/home/site/wwwroot}"
: "${FUNCTIONS_WORKER_RUNTIME:=node}"
: "${languageWorkers__node__arguments:=}"

export AzureWebJobsScriptRoot FUNCTIONS_WORKER_RUNTIME

exec /usr/lib/azure-functions-host/Microsoft.Azure.WebJobs.Script.WebHost "$@"
