Detect current environment in plugin javascript

Perhaps I missed the documentation for this but my requirements are to be able to detect which environment i’m running from within my plugins javascript file. The goal here is to define things based on the environment without modifying the main discourse project and keeping everything isolated in a plugin, I could detect the url and if it’s localhost say “I’m in dev” but I feel like that is a bit hackish, does anyone know of a way to simple say in javascript something like…

if(Discourse.env == 'dev') { //do this }

Looks like I can do Discourse.Environment , thanks for looking

4 Likes