Reputation: 976
I've been trying to load custom configuration for my application as explained in documentation and here on StackOverflow, but it fails.
I've created a new file in
/config/application.js
With contents:
module.exports.application = {
name: 'SuperApp'
};
Then in my
/views/layout.ejs
I tried to read the property:
<title><%= sails.config.application.name %></title>
And it fails with error:
Cannot read property 'name' of undefined]
path: '/Users/glfx/Projects/superapp.dev/views/layout.ejs' }
Any ideas how to fix?
Upvotes: 0
Views: 130
Reputation: 4635
This should work. Have you restarted the application after you added the config file? This is loaded during boot and is not reloaded afterward (unlike your template).
Upvotes: 1