# Help for Code revue // scripting settings.js file

**URL:** <https://discourse.nodered.org/t/help-for-code-revue-scripting-settings-js-file/58321>\
**Category:** General\
**Created:** [14 February 2022 16:53 UTC](https://discourse.nodered.org/t/help-for-code-revue-scripting-settings-js-file/58321 "2022-02-14T16:53:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigman](https://avatars.discourse-cdn.com/v4/letter/b/91b2a8/32.png) [@bigman](https://discourse.nodered.org/u/bigman)\
**Post date:** [14 February 2022 16:53 UTC](https://discourse.nodered.org/t/help-for-code-revue-scripting-settings-js-file/58321/1 "2022-02-14T16:53:10Z")

</div>

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](https://discourse.nodered.org/uploads/short-url/oMC734157lHnMzSgDI2rHf0U9rK.json) (51.6 KB)

![settings](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/0/9052928237b3ec95a67cbd5b2ecd1b4819c35dfc.png)

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

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [14 February 2022 17:54 UTC](https://discourse.nodered.org/t/help-for-code-revue-scripting-settings-js-file/58321/2 "2022-02-14T17:54:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bigman](https://avatars.discourse-cdn.com/v4/letter/b/91b2a8/32.png) [@bigman](https://discourse.nodered.org/u/bigman)\
**Post date:** [14 February 2022 18:26 UTC](https://discourse.nodered.org/t/help-for-code-revue-scripting-settings-js-file/58321/3 "2022-02-14T18:26:27Z")

</div>

Hi,  
I'm not a node.js programmer, i use to be an [Labview](https://www.ni.com/fr-fr/shop/labview.html) (small) architect --\> so i prefer graphical programming.

I just folllow the securing instruction [here](https://nodered.org/docs/user-guide/runtime/securing-node-red)

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

Thanks

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [14 February 2022 18:33 UTC](https://discourse.nodered.org/t/help-for-code-revue-scripting-settings-js-file/58321/4 "2022-02-14T18:33:19Z")

</div>

> [@bigman](#):
>
> I'm not a node.js programmer

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.

---

<div class="post-metadata">

**Author:** ![bigman](https://avatars.discourse-cdn.com/v4/letter/b/91b2a8/32.png) [@bigman](https://discourse.nodered.org/u/bigman)\
**Post date:** [14 February 2022 20:56 UTC](https://discourse.nodered.org/t/help-for-code-revue-scripting-settings-js-file/58321/5 "2022-02-14T20:56:26Z")

</div>

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](https://discourse.nodered.org/uploads/short-url/nQH1iWeboTkXwHxUgwUwpS0Y7On.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 😉

Regards.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [28 February 2022 20:56 UTC](https://discourse.nodered.org/t/help-for-code-revue-scripting-settings-js-file/58321/6 "2022-02-28T20:56:46Z")

</div>

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