Determine if running behind endpoint or not

I was previously using a condition like:
if (!process.env.RUNKIT_MOUNT_PATH) { … }
to run code in a notebook only when in “interactive mode” (so running it from Runkit manually), and skipping these when running behind an endpoint.
It seems it is not working anymore now, the code behind these if() is never executed anymore, and I see that RUNKIT_MOUNT_PATH is always defined.

I compared the available environment variables between the “intereactive” and “endpoint” modes, and now the only difference is an environment variable named EVAL_PORT. Is there any other more cleaner way to detect under which mode I’m running ? Or better, restore the previous way to use RUNKIT_MOUNT_PATH. which was working properly some days ago.

you could set some own process.env variable within the endpoint definition


*https://nodejs.org/api/process.html#process_process_env “It is possible to modify this object, but such modifications will not be reflected outside the Node.js process.”

1 Like