[dev] Default billing server URL to staging for development, allow override

Summary:
By default, the 'local'/'development' environment assumes that all services
are running locally. This makes sense.

However, if you're not making changes to auxiliary services such as
billing.nylas.com and hence do not have them running locally, firing up
Nylas Mail with the 'local' env will not work. It's a bit of a pain to
get a local billing service running locally, especially if you're not
making any changes to that service. To ease development, change the
default billing URL during development to staging, and allow manually
overriding the billing server URL to point to localhost in the case
that you're making changes to the billing service also.

To override the billing URL for local development, run like this:

    npm run cloud -- --env billing_local
    BILLING_URL=http://billing.lvh.me:5555 npm start

This is both a problem that I've run into during development as well as
(my hunch) why Karim accidentally landed a global override of the
billing server URL.

Test Plan: manual

Reviewers: evan, khamidou, halla, juan

Reviewed By: juan

Differential Revision: https://phab.nylas.com/D4202
This commit is contained in:
Christine Spang 2017-03-11 17:47:37 -08:00
parent 7e123d4894
commit c2a0df174f

View file

@ -120,7 +120,11 @@ class IdentityStore extends NylasStore {
_onEnvChanged = () => {
const env = NylasEnv.config.get('env')
if (['development', 'local'].includes(env)) {
this.URLRoot = "http://billing.lvh.me:5555";
if (process.env.BILLING_URL) {
this.URLRoot = process.env.BILLING_URL;
} else {
this.URLRoot = "https://billing-staging.nylas.com";
}
} else if (env === 'experimental') {
this.URLRoot = "https://billing-experimental.nylas.com";
} else if (env === 'staging') {