#!/usr/bin/env bash
set -e
exec 2>&1

. [% IF dev %][% root %][% ELSE %]/etc[% END %]/js-templater/conf.sh

NODE="/usr/bin/ynode"
LUSTER="/usr/share/report-renderer/node_modules/luster/bin/luster.js"
LUSTER_CONFIG="/usr/share/report-renderer/config.js"

exec $NODE --min_semi_space_size=64 --max_semi_space_size=64 --initial_old_space_size=1024 --max_old_space_size=4096 \
        $LUSTER \
        $LUSTER_CONFIG \
        -p $PORT \
        -a $OPS_PORT \
        -w $WORKERS_CNT \
        -l $LOGS_DIR \
        --requestBodyMaxBytes=1073741824 \
        --requests-limit=100 \
        --templates-package $ROUTES >/dev/null 2>&1
