Switch env var to PORT for heroku compatibility. (#57)

This commit is contained in:
William O'Beirne 2019-01-10 15:27:11 -05:00 committed by Daniel Ternyak
parent 82a7033c45
commit bd17bf2a9a
3 changed files with 5 additions and 5 deletions

View File

@ -17,7 +17,7 @@ http.createServer(function(request, response) {
html html
.toString() .toString()
.replace(/\$\$API_SECRET_KEY/g, env.API_SECRET_KEY || "") .replace(/\$\$API_SECRET_KEY/g, env.API_SECRET_KEY || "")
.replace(/\$\$REST_PORT/g, env.REST_SERVER_PORT || "") .replace(/\$\$REST_PORT/g, env.PORT || "")
); );
response.end(); response.end();
}); });

View File

@ -7,7 +7,7 @@ interface CustomEnvironment {
API_SECRET_KEY: string; API_SECRET_KEY: string;
WEBHOOK_URL: string; WEBHOOK_URL: string;
REST_SERVER_PORT: string; PORT: string;
ZCASH_NODE_URL: string; ZCASH_NODE_URL: string;
ZCASH_NODE_USERNAME: string; ZCASH_NODE_USERNAME: string;

View File

@ -15,7 +15,7 @@ import { makeContributionMemo } from '../util';
// Configure server // Configure server
const app = express(); const app = express();
app.set('port', env.REST_SERVER_PORT); app.set('port', env.PORT);
app.use(cors()); app.use(cors());
app.use(bodyParser.json()); app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.urlencoded({ extended: true }));
@ -78,8 +78,8 @@ let server: Server;
export function start() { export function start() {
return new Promise(resolve => { return new Promise(resolve => {
server = app.listen(env.REST_SERVER_PORT, () => { server = app.listen(env.PORT, () => {
console.log(`REST server started on port ${env.REST_SERVER_PORT}`); console.log(`REST server started on port ${env.PORT}`);
resolve(); resolve();
}); });
}); });