File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 11const { send } = require ( 'micro' ) ;
22const { promisify } = require ( 'util' ) ;
3+ const { existsSync } = require ( "fs" )
34
45const validateReq = require ( './lib/validateReq' ) ;
56const exec = promisify ( require ( 'child_process' ) . exec ) ;
67
8+ const workDir = process . env . NSW_WORK_DIR || '/var/www/html' ;
9+ const scriptName = process . env . NSW_SCRIPT_NAME || 'build' ;
10+ const timeout = process . env . NSW_TIMEOUT || 30 * 1000 ;
11+
712// CRITICAL: exit early if no token is defined.
813if ( ! process . env . NSW_TOKEN ) {
914 console . error ( 'NO TOKEN DEFINED, EXITING.' ) ;
10- process . exit ( 1 ) ;
15+ process . exit ( 9 ) ;
1116}
1217
13- const workDir = process . env . NSW_WORK_DIR || '/var/www/html' ;
14- const scriptName = process . env . NSW_SCRIPT_NAME || 'build' ;
15- const timeout = process . env . NSW_TIMEOUT || 30 * 1000 ;
18+ // CRITICAL: exit early if the workDir does not exists
19+ if ( ! existsSync ( workDir ) ) {
20+ console . error ( 'WORKDIR DOES NOT EXISTS, EXITING.' ) ;
21+ process . exit ( 1 ) ;
22+ }
1623
1724const handleErrors = fn => async ( req , res ) => {
1825 try {
You can’t perform that action at this time.
0 commit comments