The custom configuration for your app. This is useful for one-off settings specific to your application, like the domain to use when sending emails, or third-party API keys for Stripe, Mailgun, Twitter, Facebook, etc.
These values are usually set in the config/custom.js
file and may be overridden in production using config/env/production.js
, environment variables, or any of the other configuration mechanisms provided by Sails.
First, to set custom configuration:
// config/custom.js
module.exports.custom = {
mailgunDomain: 'transactional-mail.example.com',
mailgunApiKey: 'key-testkeyb183848139913858e8abd9a3'
};
Then, to access these values from your actions and helpers, use sails.config.custom
:
sails.config.custom.mailgunApiKey;
// -> "key-testkeyb183848139913858e8abd9a3"