Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Serve the http nodes UI from /api
app.use(settings.httpNodeRoot, RED.httpNode);
var adminApp = RED.httpAdmin;
var redNodes = RED.nodes;
if (!options.settings.server) {
var port = options ? options.port || 3001 : 3001;
server.listen(port);
RED.start().then(function () {
return callback();
});
}
else {
// Start the runtime - removing earlier timeout implementation!!
RED.start().then(function () {
return callback();
}).otherwise(function (err) {
console.log('**ERROR : NODE RED WAS NOT STARTED ***' , err);
});
}
}
logging: { console : { level : "error", audit : false } }
};
// Initialise the runtime with a server and settings
RED.init(server,settings);
// Serve the editor UI from /red
app.use(settings.httpAdminRoot, RED.httpAdmin);
// Serve the http nodes UI from /api
app.use(settings.httpNodeRoot, RED.httpNode);
server.listen(+properties.redPort);
// Start the runtime - function can be used to do work after types are loaded
RED.start().then(function () {
RED.log.info("STARTED!");
});
// Run flow configurations once flows are loaded
var EE = require('events').EventEmitter;
var logger = new EE();
RED.log.addHandler(logger);
logger.on('log', function (x) { if (x.msg === 'Starting flows') {
RED.settings.functionGlobalContext.updated = false;
// logger.removeAllListeners();
nodeAPI.putResource(device).catch(RED.log.error);
nodeAPI.putResource(pipelines).then(function () {
RED.log.info('Devices and self registred with ledger.');
RED.nodes.updateFlow('global', {
configs: [ {
functionGlobalContext: {} // enables global context
};
// Initialise the runtime with a server and settings
RED.init(server, settings);
// Serve the editor UI from /red
app.use(settings.httpAdminRoot, RED.httpAdmin);
// Serve the http nodes UI from /api
app.use(settings.httpNodeRoot, RED.httpNode);
server.listen(1880);
// Start the runtime
RED.start().then(EmbeddedStart(RED)).then((result) => {
// result is whatever RED.start() resolved to
// RED.node.getFlows() etc are now ready to use
//Still calls a little bit too fast so adding a delay.
setTimeout(() => {
callback(null);
}, 1000 * 5);
}).catch((err) => {
if (/^timed out/.test(err.message)) {
// embeddedStart() timed out
// the value that RED.start() resolved to is available as err.result
}
httpAdminRoot: '/node-red',
httpNodeRoot: '/node-red/api',
};
RED.init(server, nodeRedSettings);
app.use(nodeRedSettings.httpAdminRoot, RED.httpAdmin);
app.use(nodeRedSettings.httpNodeRoot, RED.httpNode);
await setup(app, SERVER_CONFIG);
server.listen(port, () => {
console.log(`Server started on port ${port}`);
});
RED.start();
}
public async startRED() {
this.server.close();
try {
await RED.start();
this.server.listen(this.listenPort, this.listenIp, () => {
ipcMain.emit("browser:go", this.getAdminUrl());
});
} catch (err) {
log.error(err);
}
}
copyFolderRecursiveSync(source, target);
}
}
}
}
}
}
};
let http_app = express();
let server = http.createServer(http_app);
RED.init(server, settings);
http_app.use(settings.httpAdminRoot, RED.httpAdmin);
http_app.use(settings.httpNodeRoot, RED.httpNode);
RED.start().then(function () {
server.listen(listenPort, "127.0.0.1", ()=>{
status = "online";
resolve();
});
});
} else {
status = "external";
reject();
}
});
}