Environment variable in app.js file in sails.js file

I would like to access the environment variable (config / env / development) from the app.js file.

How can I get the variables in this file?

I think I can get the variables, for example in the view, using sails.config.variableName, but I don't have a sail variable.

What I do is add setInterval (function () {stuffTODO}, 60000);

It's at the end of the app.js file. I would like to be able to put 60,000 in an environment variable to be read here.

thank

+3


source to share


1 answer


The config object is available in the Sails application instance (sails). By default this is displayed in the global scope during hoisting and is therefore accessible from anywhere in your application.

source: http://sailsjs.org/#/documentation/concepts/Configuration



This means that you must have access to the sails variable in your app.js file!

+1


source







All Articles