Fix Raven
This commit is contained in:
parent
bb5189c9ed
commit
7607759e3f
4 changed files with 17 additions and 25 deletions
20
README.md
20
README.md
|
@ -9,38 +9,30 @@ It has been through many iterations, but in its current incarnation Hostr uses [
|
||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
|
|
||||||
Everything is taken care of by an `npm install`.
|
Everything is taken care of by an `make build`.
|
||||||
|
|
||||||
### Enviroment Variable Configuration
|
### Enviroment Variable Configuration
|
||||||
|
|
||||||
See [`.env.example`](.env.example). Copy it to `.env`, modify and `source .env` for development. [autoenv](https://github.com/kennethreitz/autoenv) is pretty nice for doing this automatically when you `cd` into your work directory.
|
See [`.envrc.example`](.envrc.example). Copy it to `.envrc`, modify and `source .envrc` for development. [direnv](https://github.com/direnv/direnv) is pretty nice for doing this automatically when you `cd` into your work directory.
|
||||||
|
|
||||||
### Deploying to Heroku
|
|
||||||
|
|
||||||
You'll need to add Heroku Redis and a MongoDB addon.
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Start the app
|
### Start the app
|
||||||
|
|
||||||
```
|
```
|
||||||
$ npm start
|
$ make docker-compose-up
|
||||||
```
|
```
|
||||||
|
|
||||||
This will install and build the frontend too.
|
### Initialise the environment
|
||||||
|
|
||||||
Alternatively
|
|
||||||
|
|
||||||
```
|
```
|
||||||
$ npm run watch
|
$ make init migrate
|
||||||
```
|
```
|
||||||
|
|
||||||
Will watch your JS and CSS for changes, rebuild them, and reload the server.
|
|
||||||
|
|
||||||
### Run the tests
|
### Run the tests
|
||||||
|
|
||||||
```
|
```
|
||||||
$ npm test
|
$ make test
|
||||||
```
|
```
|
||||||
|
|
||||||
Running the tests will also set the indexes required for Mongo.
|
Running the tests will also set the indexes required for Mongo.
|
||||||
|
|
|
@ -49,8 +49,8 @@ router.use(async (ctx, next) => {
|
||||||
};
|
};
|
||||||
} else if (!err.status) {
|
} else if (!err.status) {
|
||||||
debug(err);
|
debug(err);
|
||||||
if (ctx.raven) {
|
if (ctx.Raven) {
|
||||||
ctx.raven.captureError(err);
|
ctx.Raven.captureException(err);
|
||||||
}
|
}
|
||||||
throw err;
|
throw err;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -77,7 +77,7 @@ export async function events(ctx) {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
debug('Invalid JSON for socket auth');
|
debug('Invalid JSON for socket auth');
|
||||||
ctx.websocket.send('Invalid authentication message. Bad JSON?');
|
ctx.websocket.send('Invalid authentication message. Bad JSON?');
|
||||||
ctx.raven.captureError(err);
|
ctx.Raven.captureException(err);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const reply = await ctx.redis.get(json.authorization);
|
const reply = await ctx.redis.get(json.authorization);
|
||||||
|
@ -90,7 +90,7 @@ export async function events(ctx) {
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
debug(err);
|
debug(err);
|
||||||
ctx.raven.captureError(err);
|
ctx.Raven.captureException(err);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
14
app.js
14
app.js
|
@ -8,7 +8,7 @@ import bodyparser from 'koa-bodyparser';
|
||||||
import websockify from 'koa-websocket';
|
import websockify from 'koa-websocket';
|
||||||
import helmet from 'koa-helmet';
|
import helmet from 'koa-helmet';
|
||||||
import session from 'koa-session';
|
import session from 'koa-session';
|
||||||
import raven from 'raven';
|
import Raven from 'raven';
|
||||||
import debugname from 'debug';
|
import debugname from 'debug';
|
||||||
import * as redis from './lib/redis';
|
import * as redis from './lib/redis';
|
||||||
import api, { ws } from './api/app';
|
import api, { ws } from './api/app';
|
||||||
|
@ -20,14 +20,14 @@ const app = websockify(new Koa());
|
||||||
app.keys = [process.env.COOKIE_KEY];
|
app.keys = [process.env.COOKIE_KEY];
|
||||||
|
|
||||||
if (process.env.SENTRY_DSN) {
|
if (process.env.SENTRY_DSN) {
|
||||||
const ravenClient = new raven.Client(process.env.SENTRY_DSN);
|
Raven.config(process.env.SENTRY_DSN);
|
||||||
ravenClient.patchGlobal();
|
Raven.install();
|
||||||
app.use(async (ctx, next) => {
|
app.use(async (ctx, next) => {
|
||||||
this.raven = ravenClient;
|
this.Raven = Raven;
|
||||||
await next();
|
await next();
|
||||||
});
|
});
|
||||||
app.ws.use(async (ctx, next) => {
|
app.ws.use(async (ctx, next) => {
|
||||||
this.raven = ravenClient;
|
this.Raven = Raven;
|
||||||
await next();
|
await next();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,8 @@ app.use(async (ctx, next) => {
|
||||||
try {
|
try {
|
||||||
await next();
|
await next();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (!err.statusCode && ctx.raven) {
|
if (!err.statusCode && process.env.SENTRY_DSN) {
|
||||||
ctx.raven.captureError(err);
|
Raven.captureException(err);
|
||||||
}
|
}
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue