I’m trying to get my project IP, but since this can change, I need a way to do this through nodejs.
require("child_process").execSync("echo "$(ping -c 1 -f ${PROJECT_NAME}.glitch.me) > cur_ip.txt")
^ that will set the new ip every time the script is started/restarted
also, here is how to find that ip:
url.ur.pinging ( IP_HERE )...
2 Likes
For me there is 4 (four) different possible addresses
install dns package and do this
const require('dns');
dns.resolve4(`http://${process.env.PROJECT_DOMAIN}.glitch.me`, (err, addresses) => {
if (err) console.log(err)
console.log(addresses)
})
You will have an array of four different ip
To make it clear, I didn’t try Jonyk56 method, so maybe his solution is better haha
2 Likes
hm, i have never heard of that package, well, time to go hijack my home computer with a linux vm!
with that package
darn, i never remember the module name, shall fix mine in a minute!
ok, fixed it!
this is how you get your project IP Address using your glitch project console
curl ifconfig.me
maybe you can make a request like promise to the url and get the result instead…