@unstoppabledomains/config
Advanced tools
Comparing version 0.0.9 to 0.0.10
@@ -6,4 +6,9 @@ import { Client as BugsnagClient } from '@bugsnag/js'; | ||
} | ||
export declare const getBugsnag: () => BugsnagClient | undefined; | ||
declare const notifyBugsnag: (errorObj: BugsnagError) => boolean; | ||
interface BugsnagConfig { | ||
api_key: string; | ||
app_version: string; | ||
app_env: string; | ||
} | ||
export declare const getBugsnag: (altConfig?: BugsnagConfig) => BugsnagClient | undefined; | ||
declare const notifyBugsnag: (errorObj: BugsnagError, altConfig?: BugsnagConfig) => boolean; | ||
export default notifyBugsnag; |
@@ -6,4 +6,11 @@ import BugsnagPerformance from '@bugsnag/browser-performance'; | ||
import config from '../'; | ||
export const getBugsnag = () => { | ||
if (!config.BUGSNAG.API_KEY) { | ||
export const getBugsnag = (altConfig) => { | ||
const clientConfig = config.BUGSNAG.API_KEY | ||
? { | ||
api_key: config.BUGSNAG.API_KEY, | ||
app_version: config.APP_VERSION, | ||
app_env: config.APP_ENV, | ||
} | ||
: altConfig; | ||
if (!clientConfig) { | ||
return undefined; | ||
@@ -17,6 +24,6 @@ } | ||
Bugsnag.start({ | ||
appVersion: config.APP_VERSION, | ||
apiKey: config.BUGSNAG.API_KEY, | ||
appVersion: clientConfig.app_version, | ||
apiKey: clientConfig.api_key, | ||
plugins: [new BugsnagPluginReact(React)], | ||
releaseStage: config.APP_ENV, | ||
releaseStage: clientConfig.app_env, | ||
enabledReleaseStages: ['development', 'staging', 'production'], | ||
@@ -27,7 +34,7 @@ logger: null, | ||
// start performance monitoring | ||
BugsnagPerformance.start({ apiKey: config.BUGSNAG.API_KEY }); | ||
BugsnagPerformance.start({ apiKey: clientConfig.api_key }); | ||
return bugsnagClient; | ||
}; | ||
const notifyBugsnag = (errorObj) => { | ||
const bugsnagClient = getBugsnag(); | ||
const notifyBugsnag = (errorObj, altConfig) => { | ||
const bugsnagClient = getBugsnag(altConfig); | ||
if (!bugsnagClient) { | ||
@@ -34,0 +41,0 @@ return false; |
{ | ||
"name": "@unstoppabledomains/config", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "Configuration variables for Unstoppable Domains environments", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30852
658