mirror of
https://github.com/xiaoxinpro/nginx-proxy-manager-zh.git
synced 2025-01-23 13:18:14 -05:00
56a92e5c0e
Optionally run as another user/group only if the env vars are specified. Should give flexibility to those who need to run processes as root and open ports without having to request additional priveleges
33 lines
972 B
Plaintext
Executable File
33 lines
972 B
Plaintext
Executable File
#!/command/with-contenv bash
|
|
# shellcheck shell=bash
|
|
|
|
set -e
|
|
|
|
. /bin/common.sh
|
|
|
|
cd /app || exit 1
|
|
|
|
if [ "${DEVELOPMENT:-}" = "true" ]; then
|
|
if [ "$PUID" = '0' ]; then
|
|
log_info 'Starting backend development ...'
|
|
yarn install
|
|
node --max_old_space_size=250 --abort_on_uncaught_exception node_modules/nodemon/bin/nodemon.js
|
|
else
|
|
log_info "Starting backend development as npmuser ($PUID) ..."
|
|
s6-setuidgid npmuser yarn install
|
|
exec s6-setuidgid npmuser bash -c 'export HOME=/tmp/npmuserhome;node --max_old_space_size=250 --abort_on_uncaught_exception node_modules/nodemon/bin/nodemon.js'
|
|
fi
|
|
else
|
|
while :
|
|
do
|
|
if [ "$PUID" = '0' ]; then
|
|
log_info 'Starting backend ...'
|
|
node --abort_on_uncaught_exception --max_old_space_size=250 index.js
|
|
else
|
|
log_info "Starting backend as npmuser ($PUID) ..."
|
|
s6-setuidgid npmuser bash -c 'export HOME=/tmp/npmuserhome;node --abort_on_uncaught_exception --max_old_space_size=250 index.js'
|
|
fi
|
|
sleep 1
|
|
done
|
|
fi
|