Detect if app is running on Glitch


#1

Is there a way for a program to determine if it’s running on Glitch? e.g.

if (isRunningOnGlitch) {
    console.log("Running on Glitch")
} else {
    console.log("Not running on Glitch")
}

I ask because I’m currently developing a package, and would like it to conditionally store items in .data if it’s running on Glitch.

I looked in process.env, but didn’t see anything useful. I suppose variables like PROJECT_REMIX_CHAIN are unique to Glitch, but I’m wondering if there’s a more reliable/stable way to detect.


#2

we don’t set any specific env variable, but yeah, you can do a check for all of these:

PROJECT_REMIX_CHAIN
PROJECT_ID
PROJECT_TOKEN
PROJECT_DOMAIN
INSIDE_DOCKER