mirror of
https://github.com/wassname/talk.git
synced 2026-07-27 11:28:12 +08:00
Use local IP instead of localhost
This commit is contained in:
@@ -11,6 +11,8 @@ const uniq = require('lodash/uniq');
|
||||
const ms = require('ms');
|
||||
const debug = require('debug')('talk:config');
|
||||
|
||||
const localAddress = require('ip').address();
|
||||
|
||||
//==============================================================================
|
||||
// CONFIG INITIALIZATION
|
||||
//==============================================================================
|
||||
@@ -204,10 +206,10 @@ const CONFIG = {
|
||||
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
if (!CONFIG.ROOT_URL) {
|
||||
CONFIG.ROOT_URL = 'http://localhost:3001';
|
||||
CONFIG.ROOT_URL = `http://${localAddress}:3001`;
|
||||
}
|
||||
if (!CONFIG.STATIC_URL) {
|
||||
CONFIG.STATIC_URI = 'http://localhost:3001';
|
||||
CONFIG.STATIC_URI = `http://${localAddress}:3001`;
|
||||
}
|
||||
} else if (!CONFIG.ROOT_URL) {
|
||||
throw new Error('TALK_ROOT_URL must be provided');
|
||||
@@ -261,13 +263,13 @@ CONFIG.JWT_COOKIE_NAMES = uniq(CONFIG.JWT_COOKIE_NAMES.concat([CONFIG.JWT_COOKIE
|
||||
// testing environment. Every new mongo instance comes with a test database by
|
||||
// default, this is consistent with common testing and use case practices.
|
||||
if (process.env.NODE_ENV === 'test' && !CONFIG.MONGO_URL) {
|
||||
CONFIG.MONGO_URL = 'mongodb://localhost/test';
|
||||
CONFIG.MONGO_URL = `mongodb://${localAddress}/test`;
|
||||
}
|
||||
|
||||
// Reset the redis url in the event it hasn't been overridden and we are in a
|
||||
// testing environment.
|
||||
if (process.env.NODE_ENV === 'test' && !CONFIG.REDIS_URL) {
|
||||
CONFIG.REDIS_URL = 'redis://localhost/1';
|
||||
CONFIG.REDIS_URL = `redis://${localAddress}/1`;
|
||||
}
|
||||
|
||||
// REDIS_CLUSTER_CONFIGURATION should be parsed when the cluster mode !== none.
|
||||
|
||||
@@ -54,10 +54,8 @@ const nightwatch_config = {
|
||||
},
|
||||
safari: {
|
||||
desiredCapabilities: {
|
||||
|
||||
// Safari since 8 seems to have troubles with the browserstack-local tunnel (10.18.17)
|
||||
browser: 'safari',
|
||||
browser_version: '10',
|
||||
browser_version: '11',
|
||||
},
|
||||
},
|
||||
ie: {
|
||||
|
||||
Reference in New Issue
Block a user