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

Check for Custom ENV Variable from CRA #128

Merged
merged 2 commits into from
Mar 2, 2020
Merged
Changes from 1 commit
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
3 changes: 2 additions & 1 deletion lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ var statFromShell = process.env.STAT_HOST;
var oauthFromShell = process.env.OAUTH_HOST;

var envFromBrowser = locationMatch(/\W?env=(\w+)/);
const envFromCreateReactApp = process.env.REACT_APP_ENV
Copy link
Member

Choose a reason for hiding this comment

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

This is using const, which doesn't follow convention (other variable declarations use the old school var) and will break web browser compatibility...

...if that web browser is Internet Explorer 10.

Wait, what am I complaining about?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Will make the change

var envFromShell = process.env.NODE_ENV;

var env = envFromBrowser || envFromShell || DEFAULT_ENV;
var env = envFromBrowser || envFromCreateReactApp || envFromShell || DEFAULT_ENV;

if (!env.match(/^(production|staging|development|test)$/)) {
throw new Error('Panoptes Javascript Client Error: Invalid Environment; ' +
Expand Down