Merge pull request #13682 from raisedadead/fix/update-config-for-debug-setups
fix: Update config to be flexible for hostpull/14483/head
commit
d51474f682
|
@ -12,6 +12,7 @@ import { blacklistedUsernames } from '../../server/utils/constants';
|
||||||
const debug = debugFactory('fcc:user:remote');
|
const debug = debugFactory('fcc:user:remote');
|
||||||
const BROWNIEPOINTS_TIMEOUT = [1, 'hour'];
|
const BROWNIEPOINTS_TIMEOUT = [1, 'hour'];
|
||||||
const isDev = process.env.NODE_ENV !== 'production';
|
const isDev = process.env.NODE_ENV !== 'production';
|
||||||
|
const devHost = process.env.HOST || 'localhost';
|
||||||
|
|
||||||
function getAboutProfile({
|
function getAboutProfile({
|
||||||
username,
|
username,
|
||||||
|
@ -443,7 +444,7 @@ module.exports = function(User) {
|
||||||
from: 'Team@freecodecamp.com',
|
from: 'Team@freecodecamp.com',
|
||||||
subject: 'Welcome to freeCodeCamp!',
|
subject: 'Welcome to freeCodeCamp!',
|
||||||
protocol: isDev ? null : 'https',
|
protocol: isDev ? null : 'https',
|
||||||
host: isDev ? 'localhost' : 'freecodecamp.com',
|
host: isDev ? devHost : 'freecodecamp.com',
|
||||||
port: isDev ? null : 443,
|
port: isDev ? null : 443,
|
||||||
template: path.join(
|
template: path.join(
|
||||||
__dirname,
|
__dirname,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// enable debug for gulp
|
// enable debug for gulp
|
||||||
/* eslint-disable prefer-object-spread/prefer-object-spread */
|
/* eslint-disable prefer-object-spread/prefer-object-spread */
|
||||||
process.env.DEBUG = process.env.DEBUG || 'fcc:*';
|
process.env.DEBUG = process.env.DEBUG || 'fcc:*';
|
||||||
|
require('dotenv').load();
|
||||||
|
|
||||||
require('babel-core/register');
|
require('babel-core/register');
|
||||||
const Rx = require('rx'),
|
const Rx = require('rx'),
|
||||||
|
@ -62,8 +63,10 @@ function resolve(filepath, thisString, withThisString) {
|
||||||
|
|
||||||
// user definable
|
// user definable
|
||||||
const __DEV__ = !yargs.argv.p;
|
const __DEV__ = !yargs.argv.p;
|
||||||
|
const host = process.env.HOST || 'localhost';
|
||||||
const port = yargs.argv.port || process.env.PORT || '3001';
|
const port = yargs.argv.port || process.env.PORT || '3001';
|
||||||
const syncPort = yargs.argv['sync-port'] || process.env.SYNC_PORT || '3000';
|
const syncPort = yargs.argv['sync-port'] || process.env.SYNC_PORT || '3000';
|
||||||
|
|
||||||
// make sure sync ui port does not interfere with proxy port
|
// make sure sync ui port does not interfere with proxy port
|
||||||
const syncUIPort = yargs.argv['sync-ui-port'] ||
|
const syncUIPort = yargs.argv['sync-ui-port'] ||
|
||||||
process.env.SYNC_UI_PORT ||
|
process.env.SYNC_UI_PORT ||
|
||||||
|
@ -227,7 +230,7 @@ gulp.task('dev-server', syncDepenedents, function() {
|
||||||
port: syncUIPort
|
port: syncUIPort
|
||||||
},
|
},
|
||||||
proxy: {
|
proxy: {
|
||||||
target: `http://localhost:${port}`,
|
target: `http://${host}:${port}`,
|
||||||
reqHeaders: ({ url: { hostname } }) => ({
|
reqHeaders: ({ url: { hostname } }) => ({
|
||||||
host: `${hostname}:${syncPort}`
|
host: `${hostname}:${syncPort}`
|
||||||
})
|
})
|
||||||
|
|
|
@ -5,6 +5,7 @@ import path from 'path';
|
||||||
|
|
||||||
const debug = debugFactory('fcc:user:remote');
|
const debug = debugFactory('fcc:user:remote');
|
||||||
const isDev = process.env.NODE_ENV !== 'production';
|
const isDev = process.env.NODE_ENV !== 'production';
|
||||||
|
const devHost = process.env.HOST || 'localhost';
|
||||||
|
|
||||||
function destroyAllRelated(id, Model) {
|
function destroyAllRelated(id, Model) {
|
||||||
return Observable.fromNodeCallback(
|
return Observable.fromNodeCallback(
|
||||||
|
@ -77,7 +78,7 @@ module.exports = function(app) {
|
||||||
from: 'Team@freecodecamp.com',
|
from: 'Team@freecodecamp.com',
|
||||||
subject: 'Welcome to freeCodeCamp!',
|
subject: 'Welcome to freeCodeCamp!',
|
||||||
protocol: isDev ? null : 'https',
|
protocol: isDev ? null : 'https',
|
||||||
host: isDev ? 'localhost' : 'freecodecamp.com',
|
host: isDev ? devHost : 'freecodecamp.com',
|
||||||
port: isDev ? null : 443,
|
port: isDev ? null : 443,
|
||||||
template: path.join(
|
template: path.join(
|
||||||
__dirname,
|
__dirname,
|
||||||
|
|
|
@ -4,9 +4,12 @@ let trusted = [
|
||||||
"'self'"
|
"'self'"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const host = process.env.HOST || 'localhost';
|
||||||
|
const port = process.env.PORT || process.env.SYNC_PORT || '3000';
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
trusted = trusted.concat([
|
trusted = trusted.concat([
|
||||||
'ws://localhost:3000'
|
`ws://${host}:${port}`
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue