Skip to content

Commit

Permalink
added dotenv, setup for proper server timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
dmamills committed Apr 4, 2019
1 parent 4c02d08 commit b0c1dff
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 15 deletions.
1 change: 1 addition & 0 deletions client/src/Header/Schedules/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const Schedules = ({ schedules }) => {
<div className={cn(flex, spaceBetween, p1)}>
<h1>Today's Schedule</h1>
</div>
<p>opensourceradio is proudly hosted in Toronto Canada. All times are in EST.</p>
<ul className={p0}>
{schedules.map(s => <Schedule key={s.id} schedule={s} />)}
</ul>
Expand Down
14 changes: 14 additions & 0 deletions server/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
SERVER_PORT=3001
TZ=America/Toronto

RTMP_PORT=1935
RTMP_CHUNK_SIZE=60000
RTMP_GOP_CACHE=true
RTMP_PING=60
RTMP_PING_TIMEOUT=30

RTMP_HTTP_PORT=8000
RTMP_ALLOW_ORIGIN=*

RTMP_HTTP_USER=admin
RTMP_HTTP_PASS=verycoolcat
1 change: 1 addition & 0 deletions server/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/*
*.sqlite3
.env
21 changes: 6 additions & 15 deletions server/index.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
require('dotenv').config();
const express = require('express');
const http = require('http');
const socketio = require('socket.io');
const app = express();
const cors = require('cors');
const morgan = require('morgan')
const { NodeMediaServer } = require('node-media-server');
const mediaServerConfig = require('./mediaServerConfig')

const {
SERVER_PORT
} = process.env;

const SERVER_PORT = 3001;
const api = require('./routes/api');
const { saveMessage } = require('./util');

const mediaServerConfig = {
rtmp: {
port: 1935,
chunk_size: 60000,
gop_cache: true,
ping: 60,
ping_timeout: 30
},
http: {
port: 8000,
allow_origin: '*'
}
};

const server = http.createServer(app);
const io = socketio(server);

Expand Down
32 changes: 32 additions & 0 deletions server/mediaServerConfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const {
RTMP_PORT,
RTMP_CHUNK_SIZE,
RTMP_GOP_CACHE,
RTMP_PING,
RTMP_PING_TIMEOUT,
RTMP_HTTP_PORT,
RTMP_ALLOW_ORIGIN,
RTMP_HTTP_USER,
RTMP_HTTP_PASS
} = process.env;

const mediaServerConfig = {
rtmp: {
port: RTMP_PORT,
chunk_size: RTMP_CHUNK_SIZE,
gop_cache: RTMP_GOP_CACHE,
ping: RTMP_PING,
ping_timeout: RTMP_PING_TIMEOUT
},
http: {
port: RTMP_HTTP_PORT,
allow_origin: RTMP_ALLOW_ORIGIN,
},
auth: {
api : true,
api_user: RTMP_HTTP_USER,
api_pass: RTMP_HTTP_PASS,
}
};

module.exports = mediaServerConfig;
5 changes: 5 additions & 0 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"dependencies": {
"bookshelf": "^0.14.2",
"cors": "^2.8.5",
"dotenv": "^7.0.0",
"express": "^4.16.4",
"joi": "^14.3.1",
"knex": "^0.16.3",
Expand Down

0 comments on commit b0c1dff

Please sign in to comment.