-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from patricklee2/remote-debug
Remote debug
- Loading branch information
Showing
4 changed files
with
74 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/sh | ||
|
||
# check if inspect option is used | ||
# hope we didnt match too much, should improve on this | ||
args_contain_inspect=false | ||
for arg in "$@" | ||
do | ||
case "$arg" in | ||
--inspect*) | ||
args_contain_inspect=true | ||
;; | ||
--debug*) | ||
args_contain_inspect=true | ||
;; | ||
esac | ||
done | ||
|
||
package_json="FALSE" | ||
if [ -e "/opt/startup/PACKAGE_JSON_FLAG" ] | ||
then | ||
package_json=`cat /opt/startup/PACKAGE_JSON_FLAG` | ||
fi | ||
|
||
custom_startup="FALSE" | ||
if [ -e "/opt/startup/CUSTOM_STARTUP_CMD_FLAG" ] | ||
then | ||
custom_startup=`cat /opt/startup/CUSTOM_STARTUP_CMD_FLAG` | ||
fi | ||
|
||
# enable remote debugging when node started with npm | ||
if [ "$APPSVC_REMOTE_DEBUGGING" = "TRUE" ] && ([ "$package_json" = "TRUE" ] || [ "$custom_startup" = "TRUE" ]) && [ $args_contain_inspect = false ] | ||
then | ||
node-original --inspect=0.0.0.0:$APPSVC_TUNNEL_PORT "$@" | ||
elif [ "$APPSVC_REMOTE_DEBUGGING_BREAK" = "TRUE" ] && ([ "$package_json" = "TRUE" ] || [ "$custom_startup" = "TRUE" ]) && [ $args_contain_inspect = false ] | ||
then | ||
node-original --inspect-brk=0.0.0.0:$APPSVC_TUNNEL_PORT "$@" | ||
else | ||
node-original "$@" | ||
fi |