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
24 lines (20 loc) · 849 Bytes
/
EnvironmentInfoPlugin.ts
File metadata and controls
24 lines (20 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { EnvironmentInfo } from "../../models/data/EnvironmentInfo.js";
import { EventPluginContext } from "../EventPluginContext.js";
import { IEventPlugin } from "../IEventPlugin.js";
export class EnvironmentInfoPlugin implements IEventPlugin {
public priority: number = 80;
public name: string = "EnvironmentInfoPlugin";
public run(context: EventPluginContext): Promise<void> {
const ENVIRONMENT_KEY: string = "@environment"; // optimization for minifier.
const collector = context.client.config.environmentInfoCollector;
if (!context.event.data[ENVIRONMENT_KEY] && collector) {
const environmentInfo: EnvironmentInfo = collector.getEnvironmentInfo(
context,
);
if (environmentInfo) {
context.event.data[ENVIRONMENT_KEY] = environmentInfo;
}
}
return Promise.resolve();
}
}