From 0182d38e7144b284370b2f676d8cba40180a13a6 Mon Sep 17 00:00:00 2001 From: Ian Ramzy Date: Mon, 6 Apr 2020 11:17:07 -0400 Subject: [PATCH] Fix auth keys --- .env.template | 5 +++++ .gitignore | 3 ++- README.md | 1 - server.js | 10 ++++++---- 4 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 .env.template diff --git a/.env.template b/.env.template new file mode 100644 index 0000000..732462c --- /dev/null +++ b/.env.template @@ -0,0 +1,5 @@ +# Required for all uses +# It takes 2 mins to get a free twilio account https://www.twilio.com/login + +TWILIO_ACCOUNT_SID=ACfc9705a2b725a7a314995eb8635a9079 +LOCAL_AUTH_TOKEN=654560d5d03db5548733959aa49b55bb \ No newline at end of file diff --git a/.gitignore b/.gitignore index 281707e..25dfad1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules/ .DS_Store -/.idea \ No newline at end of file +/.idea +.env \ No newline at end of file diff --git a/README.md b/README.md index 38a097f..427fecd 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ [![Repo Link](https://img.shields.io/badge/Repo-Link-black.svg)](https://github.com/ianramzy/decentralized-video-chat) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?)](https://github.com/prettier/prettier) - # https://zipcall.io Decentralized video chat platform powered by WebRTC using Twilio STUN/TURN infrastructure. diff --git a/server.js b/server.js index ca39214..aeee97c 100644 --- a/server.js +++ b/server.js @@ -1,9 +1,11 @@ require("dotenv").config(); var sslRedirect = require("heroku-ssl-redirect"); -var twilio = require("twilio")( - process.env.TWILIO_ACCOUNT_SID, - process.env.AUTH_TOKEN -); +// Get twillio auth and SID from heroku if deployed, else get from local .env file +var twillioAuthToken = + process.env.HEROKU_AUTH_TOKEN || process.env.LOCAL_AUTH_TOKEN; +var twillioAccountSID = + process.env.HEROKU_TWILLIO_SID || process.env.LOCAL_TWILLIO_SID; +var twilio = require("twilio")(twillioAccountSID, twillioAuthToken); var express = require("express"); var app = express(); var http = require("http").createServer(app);