Added a config.d.ts
Signed-off-by: Karan Shah <karan.shah@simplybusiness.co.uk>
This commit is contained in:
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2021 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export interface Config {
|
||||
/** Configuration options for the Airbrake plugin */
|
||||
airbrake?: {
|
||||
/**
|
||||
* The API Key to authenticate requests. More details on how to get this here: https://airbrake.io/docs/api/#authentication
|
||||
*/
|
||||
apiKey: string;
|
||||
};
|
||||
}
|
||||
@@ -38,7 +38,8 @@
|
||||
"msw": "^0.35.0"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
"dist",
|
||||
"config.d.ts"
|
||||
],
|
||||
"jest": {
|
||||
"coverageThreshold": {
|
||||
|
||||
@@ -14,18 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Config } from '@backstage/config';
|
||||
|
||||
/**
|
||||
* The Airbrake config object
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export type AirbrakeConfig = {
|
||||
/**
|
||||
* The API Key
|
||||
*/
|
||||
apiKey: string;
|
||||
};
|
||||
import { AirbrakeConfig } from '.';
|
||||
|
||||
/**
|
||||
* Extract the Airbrake config from a config object
|
||||
@@ -34,7 +23,9 @@ export type AirbrakeConfig = {
|
||||
*
|
||||
* @param config - The config object to extract from
|
||||
*/
|
||||
export function extractAirbrakeConfig(config: Config): AirbrakeConfig {
|
||||
export function extractAirbrakeConfig(
|
||||
config: Config,
|
||||
): AirbrakeConfig['airbrake'] {
|
||||
return {
|
||||
apiKey: config.getString('airbrake.apiKey'),
|
||||
};
|
||||
|
||||
@@ -15,4 +15,4 @@
|
||||
*/
|
||||
|
||||
export { extractAirbrakeConfig } from './ExtractAirbrakeConfig';
|
||||
export type { AirbrakeConfig } from './ExtractAirbrakeConfig';
|
||||
export type { Config as AirbrakeConfig } from '../../config';
|
||||
|
||||
Reference in New Issue
Block a user