I need to decrypt some buffers which I retrieve from my MySQL database to get a string I need to use in various places in my node.js Express module.
I can call this function everytime when I need the string however this string after being decrypted will always be the same hence calling this function everytime is not ideal as round trip to database and time to decrypt.
I can declare this as a global variable, call the function and assign to value to the global variable, or I come across this article setting this string to a process.env variable.
What's the best practise I can apply here?
Using global variable seems to me is not advisable as it can be overwritten somewhere else though chances are slim in my case.