#!/sbin/openrc-run

name="azure-functions-host"
description="Azure Functions runtime host (Node.js worker)"

command="/usr/bin/azure-functions-entrypoint"
command_background="yes"
pidfile="/run/${RC_SVCNAME}.pid"

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

export AzureWebJobsScriptRoot FUNCTIONS_WORKER_RUNTIME

depend() {
	need net
	use dns logger
}

start_pre() {
	checkpath -d -m 0755 -o azurefunc:azurefunc /home/site/wwwroot
}
