forked from exceptionless/Exceptionless.JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnvironmentInfoPlugin.ts
More file actions
22 lines (18 loc) · 819 Bytes
/
Copy pathEnvironmentInfoPlugin.ts
File metadata and controls
22 lines (18 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { IEventPlugin } from '../IEventPlugin';
import { EventPluginContext } from '../EventPluginContext';
import { IEnvironmentInfo } from '../../models/IEnvironmentInfo';
export class EnvironmentInfoPlugin implements IEventPlugin {
public priority: number = 80;
public name: string = 'EnvironmentInfoPlugin';
public run(context: EventPluginContext, next?: () => void): void {
const ENVIRONMENT_KEY: string = '@environment'; // optimization for minifier.
let collector = context.client.config.environmentInfoCollector;
if (!context.event.data[ENVIRONMENT_KEY] && collector) {
let environmentInfo: IEnvironmentInfo = collector.getEnvironmentInfo(context);
if (!!environmentInfo) {
context.event.data[ENVIRONMENT_KEY] = environmentInfo;
}
}
next && next();
}
}