From 49640d131ee6acbfe014f3df7fce53f96cd95a0a Mon Sep 17 00:00:00 2001 From: "John \"Elwin\" Edwards" Date: Wed, 14 Aug 2013 08:04:36 -0700 Subject: [PATCH] RLGWebD: use NODE_PATH to find modules. --- rlgwebd | 3 +++ rlgwebd.js | 9 ++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/rlgwebd b/rlgwebd index 9ab806e..7da8205 100755 --- a/rlgwebd +++ b/rlgwebd @@ -1,9 +1,12 @@ #!/bin/sh +NODE_PATH=/usr/lib/node_modules LOGFILE=/var/local/rlgwebd/log CTLSOCKET=/var/local/rlgwebd/ctl RLGWEBDJS=./rlgwebd.js +export NODE_PATH + if [ $UID != 0 ] then echo "$0 needs to run as root." >&2 diff --git a/rlgwebd.js b/rlgwebd.js index 42a8151..1647be7 100755 --- a/rlgwebd.js +++ b/rlgwebd.js @@ -1,7 +1,5 @@ #!/usr/bin/env node -// If you can't quite trust node to find it on its own -var localModules = '/usr/local/lib/node_modules/'; var http = require('http'); var net = require('net'); var url = require('url'); @@ -9,9 +7,10 @@ var path = require('path'); var fs = require('fs'); var events = require('events'); var child_process = require('child_process'); -var posix = require(path.join(localModules, "posix")); -var pty = require(path.join(localModules, "pty.js")); -var WebSocketServer = require(path.join(localModules, "websocket")).server; +// Dependencies +var posix = require("posix"); +var pty = require("pty.js"); +var WebSocketServer = require("websocket").server; /* Configuration variables */ // The first file is NOT in the chroot.