Optional admin authentication


I have a question regarding the adminauth option in the settingsfile.js. I need multiple nodered instances running. The settings.js is aside from some configurable settings fairly similar for each environment. But some of the environments need oauth authentication using the adminauth setting and some don't. I hope I can cover this scenario using a single settings file.
Is it possible to activate\deactivate the adminauth somehow? I tried to use setting httpAdminRoot, but setting this setting to false did not enable to open the regular node red page if setting adminauth is configured.

As the settings file is a JavaScript file, you can build whatever logic you want in it to programmatically set adminAuth, or leave it unset.

The following pseudo-code shows the sort of thing you could do. This assumes that within the code you can provide some way of knowing which environment you are running in:

// Default is adminAuth to be left undefined
let myAdminAuth;
if (environmentA) {
   myAdminAuth = { ... }
} else if (environmentB) {
   myAdminAuth = { ... }

module.exports = {
   // ...
   adminAuth: myAdminAuth
   // ...

Hi Nick,

Thanks for the answer. I will try that.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.