Help for Code revue // scripting settings.js file

Hi,
I dev. some node to recreate my settings.js file on a new machine
Warning : If you have specifics settings.js or low NR experience don't try this node

I use sublflow $env variable to modify this scripting (i turn off recreate the file for the NR Padawan)

flows_.json (51.6 KB)

settings

Everythings is working fine except the password generator using the command (payload is the pass to /hash) :

node -e "console.log(require('bcryptjs').hashSync(process.argv[1], 8));" {{payload}}

I try also using the command : **node-red admin hash-pw" --> it's working but ask user entry and i don't know how to manage user entry (in scripting bash)

If you have some optimisations,comments... tell me.

Thanks

Regards

If you are writing a custom node, why not use the bcryptjs module directly?

But honestly, if you aren't a node.js programmer, I wouldn't recommend jumping in and creating a custom node. There are a lot of things to think about and you could easily do this using a flow.

Hi,
I'm not a node.js programmer, i use to be an Labview (small) architect --> so i prefer graphical programming.

I just folllow the securing instruction here

Do you have an idea how i can fixed the generate pass in this easy way ?

Thanks

Then you probably don't want to write a custom node unless you want to become a node.js programmer!

To use the node -e "console.log(require('bcryptjs').hashSync(process.argv[1], 8));" {{payload}} command, firstly you have to be in the userDir folder. Then the {{payload}} part needs to be a valid string for the command.

HAve a look at how to use the exec command and understand that the exec environment in Node-RED isn't the same as from a terminal.

Got to run just now so can't give more info.

Hi,

Sorry i mixed flow sharing and asking help on a function.

I did some errors in variable.
Should be ok now here the flow :

flows(18).json (51.7 KB)

Did you had an expert look of my flow ?
I'm not expert in node.js, but i try to be one in NR :wink:

Regards.

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