a few more tweaks
This commit is contained in:
parent
93ee675c38
commit
f5be86e1d2
3 changed files with 16 additions and 7 deletions
3
grafana-plugin/.env.example
Normal file
3
grafana-plugin/.env.example
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
FARO_URL=http://localhost:12345/collect
|
||||
FARO_API_KEY=secret
|
||||
FARO_ENABLED=true
|
||||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue