a few more tweaks

This commit is contained in:
Rares Mardare 2022-12-16 19:49:30 +02:00
parent 93ee675c38
commit f5be86e1d2
3 changed files with 16 additions and 7 deletions

View file

@ -0,0 +1,3 @@
FARO_URL=http://localhost:12345/collect
FARO_API_KEY=secret
FARO_ENABLED=true

View file

@ -20,11 +20,6 @@
"plop": "plop",
"setversion": "setversion"
},
"faro": {
"url": "http://localhost:12345/collect",
"apiKey": "secret",
"enabled": true
},
"repository": {
"type": "git",
"url": "git+https://github.com/grafana/oncall.git"

View file

@ -10,13 +10,24 @@ import plugin from '../../package.json'; // eslint-disable-line
const IGNORE_URLS = [/^((?!\/{0,1}a\/grafana\-oncall\-app\\).)*$/];
interface FaroConfig {
url: string;
apiKey: string;
enabled: boolean;
}
class FaroHelper {
faro: Faro;
initializeFaro() {
const { faro: faroConfig } = plugin as any;
const enabled = process.env['FARO_ENABLED'].toLowerCase();
const faroConfig: FaroConfig = {
url: process.env['FARO_URL'],
apiKey: process.env['FARO_API_KEY'],
enabled: enabled === 'true',
};
if (!faroConfig.enabled || this.faro) {
if (!faroConfig?.enabled || !faroConfig?.url || !faroConfig?.apiKey || this.faro) {
return;
}