From 87efa3872193084468c25f410f5cf9189c0b976e Mon Sep 17 00:00:00 2001 From: amazedkoumei Date: Mon, 26 Jun 2017 01:13:31 +0900 Subject: more free pgconfig by .env (#3909) * more free pgconfig for streaming by .env * fix wrong default values * database.yml read ENV as same as streaming server --- streaming/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'streaming') diff --git a/streaming/index.js b/streaming/index.js index 156e1d4bc..701cb2f55 100644 --- a/streaming/index.js +++ b/streaming/index.js @@ -78,7 +78,11 @@ const startWorker = (workerId) => { const pgConfigs = { development: { - database: 'mastodon_development', + user: process.env.DB_USER || pg.defaults.user, + password: process.env.DB_PASS || pg.defaults.password, + database: process.env.DB_NAME || 'mastodon_development', + host: process.env.DB_HOST || pg.defaults.host, + port: process.env.DB_PORT || pg.defaults.port, max: 10, }, -- cgit From c972e1ee1fdc7ebc8bd4ad764cdf189ca4874764 Mon Sep 17 00:00:00 2001 From: unarist Date: Mon, 26 Jun 2017 08:45:50 +0900 Subject: Ignore DB_NAME for development env on streaming as well as rails side (#3948) --- streaming/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'streaming') diff --git a/streaming/index.js b/streaming/index.js index 701cb2f55..d69f8fa19 100644 --- a/streaming/index.js +++ b/streaming/index.js @@ -80,7 +80,7 @@ const startWorker = (workerId) => { development: { user: process.env.DB_USER || pg.defaults.user, password: process.env.DB_PASS || pg.defaults.password, - database: process.env.DB_NAME || 'mastodon_development', + database: 'mastodon_development', host: process.env.DB_HOST || pg.defaults.host, port: process.env.DB_PORT || pg.defaults.port, max: 10, -- cgit From e5563843a2c063ab0295f778428183361e0aa326 Mon Sep 17 00:00:00 2001 From: Takuya Yoshida Date: Mon, 26 Jun 2017 08:46:15 +0900 Subject: Re-fix errorMiddleware (#3922) --- streaming/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'streaming') diff --git a/streaming/index.js b/streaming/index.js index d69f8fa19..e641c6548 100644 --- a/streaming/index.js +++ b/streaming/index.js @@ -246,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' })); -- cgit From 285038972b724e646aa1a3aa2096b161524bce09 Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Mon, 26 Jun 2017 11:49:39 +0900 Subject: Stop using Babel with streaming server (#3950) --- package.json | 2 +- streaming/.babelrc | 15 --------------- streaming/index.js | 22 +++++++++++----------- 3 files changed, 12 insertions(+), 27 deletions(-) delete mode 100644 streaming/.babelrc (limited to 'streaming') diff --git a/package.json b/package.json index d1fd22fb5..4b967bad7 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "build:development": "cross-env RAILS_ENV=development ./bin/webpack", "build:production": "cross-env RAILS_ENV=production ./bin/webpack", "manage:translations": "node ./config/webpack/translationRunner.js", - "start": "rimraf ./tmp/streaming && babel ./streaming/index.js --out-dir ./tmp && node ./tmp/streaming/index.js", + "start": "node ./streaming/index.js", "storybook": "cross-env NODE_ENV=test start-storybook -s ./public -p 9001 -c storybook", "test": "npm run test:lint && npm run test:mocha", "test:lint": "eslint -c .eslintrc.yml --ext=js app/javascript/ config/webpack/ spec/javascript/ storybook/ streaming/", 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 e641c6548..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'; -- cgit