How to change the original code of a Node

#1

Hello!

I am using the node-red-contrib-google-iot-core (version 0.0.4) to connect via MQTT with my Google IoT Broker.

I want to change a little bit the code of this Node. Is that possible?

I want to change the code that it's in the address /home/pi/.node-red/node_modules/node-red-contrib-google-iot-core/google-iot-core.js

In function createJwt I want to change:
'exp': Math.round(Date.now() / 1000) + 60 * 60, // 60 minutes
-->
'exp': Math.round(Date.now() / 1000) + 60 * 60 * 24, // 24 hours

What steps should I follow to make it work the changes that I have done in google-iot-core.js?

Thank you!

0 Likes

#2

If this is just on your system, just change the code and restart NR

0 Likes

#3

Or you can just raise an issue in that Github repository, and ask the author to add an option (to the node's config screen) where you can add the time frequency (minute, hours, …). That way you are sure your changes will never be overwritten accidentally afterwards.
Bart

0 Likes

#4

Or you can clone the original repository, change your copy and install from that directly.

0 Likes