config.js 1 KB
'use strict';

const path = require('path');

const env = process.env.NODE_ENV || 'development';

const defaults = {
	port: 9000,
	buildDir: path.normalize(__dirname + '/../packages/'),
	dbDir: path.normalize(__dirname + '/../db'),
	influxdb: {
		host: 'influxdblog.web.yohoops.org',
		port: 4444
	},
	redis: {
		connect: {
			// host: '127.0.0.1',
			 host: 'web.redis.yohoops.org',
		},
		port: '6379',
		retry_strategy(options) {
			if (options.error && options.error.code === 'ECONNREFUSED') {
				console.log('redis连接不成功');
			}
			if (options.total_retry_time > 1000 * 60 * 60 * 6) {
				console.log('redis连接超时');
				return;
			}
			if (options.attempt > 10) {
				return 1000 * 60 * 60 * 0.5;
			}
			return Math.min(options.attempt * 100, 1000);
		}
	},
	mysql: {
		host: '192.168.102.219',
		user: 'yh_test',
		password: 'yh_test',
		port: '3306',
		database: 'seo',
	}
};

const specific = {
	development: {},
	test: {},
	production: {},
};

module.exports = Object.assign(defaults, specific[env]);