forked from metacpan/metacpan-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-dev
executable file
·24 lines (20 loc) · 872 Bytes
/
run-dev
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash
export METACPAN_WEB_PORT=5001
export PLACK_ENV=development
export COLUMNS="$(tput cols)"
suffix="$METACPAN_WEB_CONFIG_LOCAL_SUFFIX"
[ -z "$suffix" ] && suffix="local"
log4perl="$(perl -MConfig::ZOMG -e'print Config::ZOMG->new(name => "MetaCPAN::Web")->load->{log4perl_file}')"
[ -z "$log4perl" ] && log4perl="log4perl.conf"
plackup -r -R metacpan_web.conf -R "metacpan_web_$suffix.conf" -R "$log4perl" -o localhost -p "$METACPAN_WEB_PORT" &
app_pid="$!"
trap 'kill "$app_pid"; exit 1' SIGHUP SIGINT SIGTERM SIGQUIT
while true; do
sleep 1
( echo '' >/dev/tcp/localhost/"$METACPAN_WEB_PORT" ) 2>/dev/null && break
done
for fast_handler in Feersum Gazelle Starlet Starman; do
perl -mPlack::Handler::$fast_handler -e1 &>/dev/null && break
done
plackup --no-default-middleware -s "$fast_handler" -o localhost -p 5000 static-app.psgi
kill "$app_pid"