Sails.js gets environment value from configuration

I am using Sails.js with the default template engine ( EJS ). I have a view defined directly from config routes:

configurations /routes.js

'/': { view: 'homepage' } 

Is there any way to access the environment on the homepage.ejs page? I need something like this:

views / homepage.ejs (the next one doesn't work, so I need a working solution)

 ... <span>Hello you are on <%= sails.env %> environment</span> ... 

will display as:

 Hello you are on production environment 

Please do not suggest me create a controller for this.

I hope that there is a way to get it either directly from the submission, or through local residents on the route, but how is this a question.

+5
source share
1 answer

try it

 <%= sails.config.environment %> 
+8
source

All Articles