WebReflection / benja

Bootable Electron Node JS Application
https://archibold.io/benja/
194 stars 32 forks source link

[Suggestion] `BENJA` environment variable #30

Closed shroudedcode closed 7 years ago

shroudedcode commented 7 years ago

It would be great if Benja would always set a specific environment variable to true, maybe BENJA or BENJA_OS. This would allow developers to easily check whether their application is currently running on a Benja device, like this:

if(process.env.BENJA)
  console.log("I'm on a Benja device! :D")
else
  console.log("I'm on a normal computer. :I")

Travis CI offers a similar variable called TRAVIS that indicates that a program is run by a Travis build.

WebReflection commented 7 years ago
if (/^x\d+/.test(process.arch)) {
  console.log("I'm on a normal computer. :I");
} else {
  console.log("I'm on a Benja device! :D");
}
shroudedcode commented 7 years ago

@WebReflection Thanks for the quick answer!

WebReflection commented 7 years ago

sorry I rushed, but re-creating 12 ISO of 8 GB each to put some info you could discover otherwise is not my highest priority now.

However, you're totally right, there should be some unique env variable to check against.

That's the best way to go, but not these days. Apologies.

WebReflection commented 7 years ago

P.S. will be in, next deploy!