Skip to content

Instantly share code, notes, and snippets.

@JacobKnaack

JacobKnaack/config.js Secret

Created Jun 14, 2019
Embed
What would you like to do?
Cosmic Messenger Twilio Configuration file
require('dotenv').config();
var cfg = {};
cfg.accountSid = process.env.__TWILIO_ACCOUNT_SID__;
cfg.authToken = process.env.__TWILIO_AUTH_TOKEN__;
cfg.sendingNumber = process.env.__TWILIO_NUMBER__;
cfg.adminNumbers = [{ phoneNumber: process.env.__ADMIN_NUMBER__ }];
var requiredConfig = [cfg.accountSid, cfg.authToken, cfg.sendingNumber, cfg.adminNumbers];
var isConfigured = requiredConfig.every(function (configValue) {
return configValue || false;
});
if (!isConfigured) {
var errorMessage =
'TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, and TWILIO_NUMBER must be set.';
throw new Error(errorMessage);
}
// Export configuration object
module.exports = cfg;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.