Hey there,
I'm looking to customize the UI and possibly hide or inject certain element on the node-red editor. Is there a way to have a javascript file be called on startup of node-red and run in the window?
Seems like this would probably be a useful feature.
Here's how I'm starting node red (v2) right now.
const express = require("express");
const RED = require("node-red");
const path = require("path");
const jwt = require("jsonwebtoken");
const dbConfig = require("./pg-db.config");
const app = express();
const { PostgresNodeREDAdapter } = require("./PostgresNodeREDAdapter");
const logDebug = require("./logDebug");
app.enable("trust proxy");
const port = process.env.PORT || 6700;
const authSecret = process.env.TG_AUTH_SECRET;
app.use("/", express.static("public"));
console.info(`Starting up Node-RED on port ${port}`);
if (process.env.DEBUG_NODE_RED) {
console.info(`Node-RED debug logging enabled`);
}
const server = app.listen(port, () =>
console.info(`Node-RED server listening on port ${port}!`)
);
const userDir = path.resolve(__dirname, "../node-red-data");
const settings = {
editorTheme: {
theme: "midnight-red",
codeEditor: {
lib: "monaco",
options: {
theme: "vs-dark"
}
}
},
nrlint: require("./.nrlintrc.js"),
httpAdminRoot: "/node-red-editor",
httpNodeRoot: "/node-red-api",
userDir,
dbConfig,
autoInstallModules: true,
storageModule: new PostgresNodeREDAdapter(),
adminAuth: {
...etc
},
functionGlobalContext: {
...etc
} // enables global context
};
RED.init(server, settings);
app.use(settings.httpAdminRoot, RED.httpAdmin);
app.use(settings.httpNodeRoot, RED.httpNode);
// Start the runtime
RED.start();
Thanks in advance!
-Thomas