Skip to content

Commit

Permalink
let uiHost be set by security question
Browse files Browse the repository at this point in the history
(force to 127.0.0.1 if no admin password)
  • Loading branch information
dceejay committed Jan 5, 2024
1 parent cdbd002 commit b6873ba
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
7 changes: 6 additions & 1 deletion lib/commands/init/index.js
Expand Up @@ -135,7 +135,7 @@ async function promptSecurity() {
type: 'select',
name: 'adminAuth',
initial: "Yes",
message: 'Do you want to setup user security?',
message: 'Do you want to setup user security?\n DO NOT select No if you will expose Node-RED to the internet - or you will be hacked!',
choices: ['Yes', 'No'],
result(value) {
return value === "Yes"
Expand All @@ -160,6 +160,10 @@ async function promptSecurity() {
break;
}
}
responses.uiHost = '//uiHost: "0.0.0.0",'
}
else {
responses.uiHost = 'uiHost: "127.0.0.1",'
}
return responses;
}
Expand Down Expand Up @@ -287,6 +291,7 @@ async function command(argv, result) {
};
config.adminAuth = JSON.stringify(adminAuth,"",4).replace(/\n/g,"\n ");
}
config.uiHost = securityResponses.uiHost;

const projectsResponses = await promptProjects();
let flowFileSettings = {};
Expand Down
10 changes: 5 additions & 5 deletions lib/commands/init/resources/settings.js.mustache
Expand Up @@ -151,7 +151,7 @@ module.exports = {
* The following property can be used to listen on a specific interface. For
* example, the following would only allow connections from the local machine.
*/
//uiHost: "127.0.0.1",
{{uiHost}},

/** The maximum size of HTTP request that will be accepted by the runtime api.
* Default: 5mb
Expand Down Expand Up @@ -222,17 +222,17 @@ module.exports = {
/** When httpAdminRoot is used to move the UI to a different root path, the
* following property can be used to identify a directory of static content
* that should be served at http://localhost:1880/.
* When httpStaticRoot is set differently to httpAdminRoot, there is no need
* When httpStaticRoot is set differently to httpAdminRoot, there is no need
* to move httpAdminRoot
*/
//httpStatic: '/home/nol/node-red-static/', //single static source
/* OR multiple static sources can be created using an array of objects... */
//httpStatic: [
// {path: '/home/nol/pics/', root: "/img/"},
// {path: '/home/nol/reports/', root: "/doc/"},
// {path: '/home/nol/pics/', root: "/img/"},
// {path: '/home/nol/reports/', root: "/doc/"},
//],

/**
/**
* All static routes will be appended to httpStaticRoot
* e.g. if httpStatic = "/home/nol/docs" and httpStaticRoot = "/static/"
* then "/home/nol/docs" will be served at "/static/"
Expand Down

0 comments on commit b6873ba

Please sign in to comment.