添加环境变量local
This commit is contained in:
+12
-5
@@ -39,8 +39,15 @@ adminfilePath.ADMIN_USER = 'config/adminUser';
|
||||
*/
|
||||
preload();
|
||||
|
||||
let mongoAddr = 'mongodb://dbop:zyzdbopbantu@dds-8vbdb47c6fb58a541.mongodb.zhangbei.rds.aliyuncs.com:3717,dds-8vbdb47c6fb58a542.mongodb.zhangbei.rds.aliyuncs.com:3717/zyz?replicaSet=mgset-500808098';
|
||||
let redisArr = 'r-8vb4i2kgl91886fkxd.redis.zhangbei.rds.aliyuncs.com';
|
||||
if(process.env.NODE_ENV == 'local') {
|
||||
mongoAddr = 'mongodb://127.0.0.1/admin';
|
||||
redisArr = '127.0.0.1';
|
||||
}
|
||||
|
||||
// 创建 mongodb 连接
|
||||
mongoose.connect('mongodb://dbop:zyzdbopbantu@dds-8vbdb47c6fb58a541.mongodb.zhangbei.rds.aliyuncs.com:3717,dds-8vbdb47c6fb58a542.mongodb.zhangbei.rds.aliyuncs.com:3717/zyz?replicaSet=mgset-500808098', { useNewUrlParser: true, useUnifiedTopology: true }, (err) => {
|
||||
mongoose.connect(mongoAddr, { useNewUrlParser: true, useUnifiedTopology: true }, (err) => {
|
||||
if (err) {
|
||||
console.log('mongodb connect err', err);
|
||||
} else {
|
||||
@@ -49,7 +56,7 @@ mongoose.connect('mongodb://dbop:zyzdbopbantu@dds-8vbdb47c6fb58a541.mongodb.zhan
|
||||
});
|
||||
|
||||
// 创建 redis 连接
|
||||
const client = redis.createClient(6379, 'r-8vb4i2kgl91886fkxd.redis.zhangbei.rds.aliyuncs.com', {detect_buffers: true});
|
||||
const client = redis.createClient(6379, redisArr, {detect_buffers: true});
|
||||
client.auth('zyz_2020', (err, reply) => {
|
||||
if (err) {
|
||||
console.log('redis err', err);
|
||||
@@ -66,7 +73,7 @@ let app = pinus.createApp();
|
||||
app.set('name', 'chatofpomelo-websocket');
|
||||
|
||||
// app configuration
|
||||
app.configure('production|development', 'connector', function () {
|
||||
app.configure('production|development|local', 'connector', function () {
|
||||
app.set('connectorConfig',
|
||||
{
|
||||
connector: pinus.connectors.hybridconnector,
|
||||
@@ -91,7 +98,7 @@ app.configure('production|development', 'connector', function () {
|
||||
});
|
||||
});
|
||||
|
||||
app.configure('production|development', 'gate', function () {
|
||||
app.configure('production|development|local', 'gate', function () {
|
||||
app.set('connectorConfig',
|
||||
{
|
||||
connector: pinus.connectors.hybridconnector,
|
||||
@@ -163,7 +170,7 @@ app.configure('production|development', function () {
|
||||
});
|
||||
});
|
||||
|
||||
app.configure('development', function () {
|
||||
app.configure('development|local', function () {
|
||||
// enable the system monitor modules
|
||||
app.enable('systemMonitor');
|
||||
app.enable('rpcDebugLog');
|
||||
|
||||
Reference in New Issue
Block a user