Edit Page

Custom configuration

What is this?

#

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.

Example

#

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"

Is something missing?

If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the sails repo. Once we merge it, the changes will be reflected on the website the next time it is deployed.

Reference

Reference