diff options
Diffstat (limited to 'streaming')
-rw-r--r-- | streaming/.babelrc | 15 | ||||
-rw-r--r-- | streaming/index.js | 28 |
2 files changed, 16 insertions, 27 deletions
diff --git a/streaming/.babelrc b/streaming/.babelrc deleted file mode 100644 index dc1ec4303..000000000 --- a/streaming/.babelrc +++ /dev/null @@ -1,15 +0,0 @@ -{ - "presets": [ - [ - "env", - { - "targets": { - "node": "current" - } - } - ] - ], - "plugins": [ - "transform-object-rest-spread" - ] -} diff --git a/streaming/index.js b/streaming/index.js index 156e1d4bc..400456d24 100644 --- a/streaming/index.js +++ b/streaming/index.js @@ -1,14 +1,14 @@ -import os from 'os'; -import throng from 'throng'; -import dotenv from 'dotenv'; -import express from 'express'; -import http from 'http'; -import redis from 'redis'; -import pg from 'pg'; -import log from 'npmlog'; -import url from 'url'; -import WebSocket from 'uws'; -import uuid from 'uuid'; +const os = require('os'); +const throng = require('throng'); +const dotenv = require('dotenv'); +const express = require('express'); +const http = require('http'); +const redis = require('redis'); +const pg = require('pg'); +const log = require('npmlog'); +const url = require('url'); +const WebSocket = require('uws'); +const uuid = require('uuid'); const env = process.env.NODE_ENV || 'development'; @@ -78,7 +78,11 @@ const startWorker = (workerId) => { const pgConfigs = { development: { + user: process.env.DB_USER || pg.defaults.user, + password: process.env.DB_PASS || pg.defaults.password, database: 'mastodon_development', + host: process.env.DB_HOST || pg.defaults.host, + port: process.env.DB_PORT || pg.defaults.port, max: 10, }, @@ -242,7 +246,7 @@ const startWorker = (workerId) => { accountFromRequest(req, next); }; - const errorMiddleware = (err, req, res, next) => { // eslint-disable-line no-unused-vars + const errorMiddleware = (err, req, res, {}) => { log.error(req.requestId, err.toString()); res.writeHead(err.statusCode || 500, { 'Content-Type': 'application/json' }); res.end(JSON.stringify({ error: err.statusCode ? err.toString() : 'An unexpected error occurred' })); |