#!/usr/bin/env /lib/runit/invoke-run
#Copyright: 2019 Cloux <cloux@rote.ch>
#             2023  Lorenzo Puliti <plorenzo@disroot.org>
#License: CC0-1.0

exec 2>&1

if ! ##bin## -t -q -c /etc/nginx/nginx.conf -g 'daemon off;' ; then
    echo "${PWD##*/}: config test failed"
    sv d "${PWD##*/}"
fi

# nginx only provides a config file option to run in the foreground:
exec ##bin## -c /etc/nginx/nginx.conf -g 'daemon off;'
