-
-
Save JacobKnaack/7e994a3896ec8180c046fa19c32ee24d to your computer and use it in GitHub Desktop.
Cosmic Messenger Twilio Configuration file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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