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

Change default oAuth Host and allow config #126

Merged
merged 2 commits into from
Feb 20, 2020
Merged
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
6 changes: 4 additions & 2 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var API_APPLICATION_IDS = {
};

var OAUTH_HOSTS = {
production: 'https://panoptes.zooniverse.org',
production: 'https://www.zooniverse.org',
staging: 'https://panoptes-staging.zooniverse.org',
development: 'https://panoptes-staging.zooniverse.org',
test: 'https://panoptes-staging.zooniverse.org'
Expand Down Expand Up @@ -47,12 +47,14 @@ var appFromBrowser = locationMatch(/\W?panoptes-api-application=([^&]+)/);
var talkFromBrowser = locationMatch(/\W?talk-host=([^&]+)/);
var sugarFromBrowser = locationMatch(/\W?sugar-host=([^&]+)/);
var statFromBrowser = locationMatch(/\W?stat-host=([^&]+)/);
var oauthFromBrowser = locationMatch(/\W?oauth-host=([^&]+)/);

var hostFromShell = process.env.PANOPTES_API_HOST;
var appFromShell = process.env.PANOPTES_API_APPLICATION;
var talkFromShell = process.env.TALK_HOST;
var sugarFromShell = process.env.SUGAR_HOST;
var statFromShell = process.env.STAT_HOST;
var oauthFromShell = process.env.OAUTH_HOST;

var envFromBrowser = locationMatch(/\W?env=(\w+)/);
var envFromShell = process.env.NODE_ENV;
Expand Down Expand Up @@ -92,7 +94,7 @@ module.exports = {
talkHost: talkFromBrowser || talkFromShell || TALK_HOSTS[env],
sugarHost: sugarFromBrowser || sugarFromShell || SUGAR_HOSTS[env],
statHost: statFromBrowser || statFromShell || STAT_HOSTS[env],
oauthHost: OAUTH_HOSTS[env],
oauthHost: oauthFromBrowser || oauthFromShell || OAUTH_HOSTS[env],
params: defaultParams,
jsonHeaders: JSON_HEADERS
};
Expand Down