How can I get the hostname and set it in a variable? NodeJS

I want to get the hostname and then set it to a variable.

Use case:
The email to reset the password is something like www.hostname1.com/?email=bla@bla.com&hash=xyz

I want to change it to a variable, so when I publish to another target it still works:
www.hostname200.com/?email=bla@bla.com&hash=xyz

I’m attempting to put them in the Globals in a server action and then put that server action on the page, but I don’t understand how the Globals work. (trying to do something similar to this guide)

Community Page
Last updated: