Commit d630efb2 authored by Matthew Taylor's avatar Matthew Taylor

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.
parent cf2a5cc4
...@@ -30,8 +30,12 @@ Use `^C` to stop the node process `npm start` starts. ...@@ -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 | | `API_HOST` | `https://api.scratch.mit.edu` | Hostname for API requests |
| `NODE_ENV` | `null` | If not `production`, app acts like development | | `NODE_ENV` | `null` | If not `production`, app acts like development |
| `PORT` | `8333` | Port for devserver (http://localhost:XXXX) | | `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 | | `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 ### To Test
```bash ```bash
npm test npm test
......
...@@ -79,10 +79,13 @@ if (!isProduction) { ...@@ -79,10 +79,13 @@ if (!isProduction) {
} }
})); }));
// Fall back to scratchr2 in development var shouldFallback = (process.env.FALLBACK === 'true') || false;
// This proxy middleware must come last if (shouldFallback) {
var proxyHost = process.env.PROXY_HOST || 'https://scratch.mit.edu'; // Fall back to scratchr2 in development
app.use('/', proxy(proxyHost)); // This proxy middleware must come last
var proxyHost = process.env.PROXY_HOST || 'https://scratch.mit.edu';
app.use('/', proxy(proxyHost));
}
} }
// Start listening // Start listening
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment