Skip to content

Commit

Permalink
Use dotenv package for environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Fcmam5 committed Oct 14, 2019
1 parent 19b7e87 commit e98e52b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .env.example
@@ -0,0 +1,2 @@
YT3_API_KEY=YOUR_YOUTUBE_DATA_API_V3_KEY
DM_API_KEY=YOUR_DAILYMOTION_API_KEY
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
node_modules/
index_old.html
app-env
.env
3 changes: 1 addition & 2 deletions README.md
Expand Up @@ -39,8 +39,7 @@ Install Dependencies
npm install
```

Obtain API keys for YouTube Data API V3 and Dailymotion SDK (Optional) and
source it to your path as YT3_API_KEY and DM_API_KEY respectively
Create a `.env` file and add API keys for YouTube Data API V3 and Dailymotion SDK (Optional) as YT3_API_KEY and DM_API_KEY

Run the server
```
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -13,6 +13,7 @@
"author": "Kyle Lim",
"license": "ISC",
"dependencies": {
"dotenv": "8.1.0",
"express": "*",
"lodash": "^4.17.11",
"socket.io": "*"
Expand Down
6 changes: 4 additions & 2 deletions server.js
@@ -1,3 +1,5 @@
require('dotenv').config();

var express = require('express');
var app = express();
var server = require('http').createServer(app);
Expand All @@ -8,8 +10,8 @@ rooms = [];
// Store all of the sockets and their respective room numbers
userrooms = {}

YT3_API_KEY = process.env.YT3_API_KEY
DM_API_KEY = process.env.DM_API_KEY
YT3_API_KEY = process.env.YT3_API_KEY;
DM_API_KEY = process.env.DM_API_KEY;

// Set given room for url parameter
var given_room = ""
Expand Down

0 comments on commit e98e52b

Please sign in to comment.