mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Don't start if user has no home directory
If the user doesn't have a defined home dir (env var `HOME`, `USERPROFILE` or `HOMEPATH`) and the `userDir` is not passed on the command line then we shouldn't start as we don't know where to copy the default `settings.js` file to or where to store flows fixes #3539
This commit is contained in:
parent
3a26c5cd65
commit
889f0e1569
4
packages/node_modules/node-red/red.js
vendored
4
packages/node_modules/node-red/red.js
vendored
@ -112,6 +112,10 @@ if (parsedArgs.settings) {
|
||||
// Consider compatibility for older versions
|
||||
settingsFile = path.join(process.env.HOMEPATH,".node-red","settings.js");
|
||||
} else {
|
||||
if (!parsedArgs.userDir && !(process.env.HOME || process.env.USERPROFILE || process.env.HOMEPATH)) {
|
||||
console.log("User has no Home Directory and no userDir set")
|
||||
process.exit()
|
||||
}
|
||||
var userDir = parsedArgs.userDir || path.join(process.env.HOME || process.env.USERPROFILE || process.env.HOMEPATH,".node-red");
|
||||
var userSettingsFile = path.join(userDir,"settings.js");
|
||||
if (fs.existsSync(userSettingsFile)) {
|
||||
|
Loading…
Reference in New Issue
Block a user