Document environment variables, remove .env.sample

This commit is contained in:
Ray Schamp 2015-10-07 11:48:18 -04:00
parent 621c32a605
commit a701c0829f
3 changed files with 11 additions and 5 deletions

View file

@ -1,3 +0,0 @@
NODE_ENV=development
PROXY_HOST=http://localhost
PROXY_PORT=8080

View file

@ -18,6 +18,16 @@ npm start
Once running, open `http://localhost:8333` in your browser. If you wish to have the server reload automatically, you can install either [nodemon](https://github.com/remy/nodemon) or [forever](https://github.com/foreverjs/forever). Once running, open `http://localhost:8333` in your browser. If you wish to have the server reload automatically, you can install either [nodemon](https://github.com/remy/nodemon) or [forever](https://github.com/foreverjs/forever).
#### Configuration
`npm start` and `npm run watch` can be configured with the following environment variables
| Variable | Default | Description |
| ------------- | --------------------------------- | ---------------------------------------------- |
| `NODE_ENV` | `null` | If not `production`, app acts like development |
| `PORT` | `8333` | Port for devserver (http://localhost:XXXX) |
| `PROXY_HOST` | `https://staging.scratch.mit.edu` | Pass-through location for scratchr2 |
### To Test ### To Test
```bash ```bash
npm test npm test

View file

@ -27,8 +27,7 @@ for (var routeId in routes) {
if ( process.env.NODE_ENV != 'production' ) { if ( process.env.NODE_ENV != 'production' ) {
var proxies = require('./proxies.json'); var proxies = require('./proxies.json');
var url = require('url'); var url = require('url');
var proxyHost = process.env.PROXY_HOST || 'http://localhost'; var proxyHost = process.env.PROXY_HOST || 'https://staging.scratch.mit.edu';
proxyHost += ':' + (process.env.PROXY_PORT || 8080);
for (var proxyId in proxies) { for (var proxyId in proxies) {
var proxyRoute = proxies[proxyId]; var proxyRoute = proxies[proxyId];
app.use(proxyRoute.root, proxy(proxyRoute.proxy || proxyHost, { app.use(proxyRoute.root, proxy(proxyRoute.proxy || proxyHost, {