Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent config to be bundled in client. #633

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@
/* eslint-disable max-len */
/* jscs:disable maximumLineLength */

/**
* WARNING: Do not include this file in client build.
*/
const DO_NOT_USE_THIS_FILE_IN_CLIENT = `
Configuration file contaions sensitive information and
Copy link

@aaron-harvey aaron-harvey Nov 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spelling: contains

MUST NOT be included in the client build.
`;

if (process.env.BROWSER) {
alert(DO_NOT_USE_THIS_FILE_IN_CLIENT); // eslint-disable-line no-alert
throw new Error(DO_NOT_USE_THIS_FILE_IN_CLIENT);
}

export const port = process.env.PORT || 3000;
export const host = process.env.WEBSITE_HOSTNAME || `localhost:${port}`;

Expand Down