Add shouldFallback process env variable

So that it's clear to newcomers what things are not yet completed in scratch-www as we build it out.
This commit is contained in:
Matthew Taylor 2015-12-03 10:41:02 -05:00
parent cf2a5cc477
commit d630efb23c
2 changed files with 11 additions and 4 deletions

View file

@ -30,8 +30,12 @@ Use `^C` to stop the node process `npm start` starts.
| `API_HOST` | `https://api.scratch.mit.edu` | Hostname for API requests |
| `NODE_ENV` | `null` | If not `production`, app acts like development |
| `PORT` | `8333` | Port for devserver (http://localhost:XXXX) |
| `FALLBACK` | `false` | Whether or not to fallback to `PROXY_HOST` for non-existent pages/reqeusts |
| `PROXY_HOST` | `https://scratch.mit.edu` | Pass-through location for scratchr2 |
#### Current issues with the development
* Login does not work (*In the process of being fixed*)
### To Test
```bash
npm test

View file

@ -79,10 +79,13 @@ if (!isProduction) {
}
}));
var shouldFallback = (process.env.FALLBACK === 'true') || false;
if (shouldFallback) {
// Fall back to scratchr2 in development
// This proxy middleware must come last
var proxyHost = process.env.PROXY_HOST || 'https://scratch.mit.edu';
app.use('/', proxy(proxyHost));
}
}
// Start listening