Merge pull request #13682 from raisedadead/fix/update-config-for-debug-setups

fix: Update config to be flexible for host
pull/14483/head
Berkeley Martinez 2017-04-17 14:39:52 -07:00 committed by GitHub
commit d51474f682
4 changed files with 12 additions and 4 deletions

View File

@ -12,6 +12,7 @@ import { blacklistedUsernames } from '../../server/utils/constants';
const debug = debugFactory('fcc:user:remote');
const BROWNIEPOINTS_TIMEOUT = [1, 'hour'];
const isDev = process.env.NODE_ENV !== 'production';
const devHost = process.env.HOST || 'localhost';
function getAboutProfile({
username,
@ -443,7 +444,7 @@ module.exports = function(User) {
from: 'Team@freecodecamp.com',
subject: 'Welcome to freeCodeCamp!',
protocol: isDev ? null : 'https',
host: isDev ? 'localhost' : 'freecodecamp.com',
host: isDev ? devHost : 'freecodecamp.com',
port: isDev ? null : 443,
template: path.join(
__dirname,

View File

@ -1,6 +1,7 @@
// enable debug for gulp
/* eslint-disable prefer-object-spread/prefer-object-spread */
process.env.DEBUG = process.env.DEBUG || 'fcc:*';
require('dotenv').load();
require('babel-core/register');
const Rx = require('rx'),
@ -62,8 +63,10 @@ function resolve(filepath, thisString, withThisString) {
// user definable
const __DEV__ = !yargs.argv.p;
const host = process.env.HOST || 'localhost';
const port = yargs.argv.port || process.env.PORT || '3001';
const syncPort = yargs.argv['sync-port'] || process.env.SYNC_PORT || '3000';
// make sure sync ui port does not interfere with proxy port
const syncUIPort = yargs.argv['sync-ui-port'] ||
process.env.SYNC_UI_PORT ||
@ -227,7 +230,7 @@ gulp.task('dev-server', syncDepenedents, function() {
port: syncUIPort
},
proxy: {
target: `http://localhost:${port}`,
target: `http://${host}:${port}`,
reqHeaders: ({ url: { hostname } }) => ({
host: `${hostname}:${syncPort}`
})

View File

@ -5,6 +5,7 @@ import path from 'path';
const debug = debugFactory('fcc:user:remote');
const isDev = process.env.NODE_ENV !== 'production';
const devHost = process.env.HOST || 'localhost';
function destroyAllRelated(id, Model) {
return Observable.fromNodeCallback(
@ -77,7 +78,7 @@ module.exports = function(app) {
from: 'Team@freecodecamp.com',
subject: 'Welcome to freeCodeCamp!',
protocol: isDev ? null : 'https',
host: isDev ? 'localhost' : 'freecodecamp.com',
host: isDev ? devHost : 'freecodecamp.com',
port: isDev ? null : 443,
template: path.join(
__dirname,

View File

@ -4,9 +4,12 @@ let trusted = [
"'self'"
];
const host = process.env.HOST || 'localhost';
const port = process.env.PORT || process.env.SYNC_PORT || '3000';
if (process.env.NODE_ENV !== 'production') {
trusted = trusted.concat([
'ws://localhost:3000'
`ws://${host}:${port}`
]);
}