#!/command/with-contenv bash
# shellcheck shell=bash

set -e

. /bin/common.sh

if [ "$(is_true "$DEBUG")" = '1' ]; then
	set -x
fi

# This service is DEVELOPMENT only.
if [ "$(is_true "$DEVELOPMENT")" = '1' ]; then
	CI=true
	HOME=$NPMHOME
	export CI
	export HOME

	cd /app/frontend || exit 1

	log_info 'Starting frontend ...'
	s6-setuidgid "$PUID:$PGID" yarn install
	exec s6-setuidgid "$PUID:$PGID" yarn dev
else
	exit 0
fi
