From 13bc306bd02d9b2f1fb124239444f7611c68d379 Mon Sep 17 00:00:00 2001 From: Tom de Bruijn Date: Wed, 5 Oct 2022 15:09:54 +0200 Subject: [PATCH] Remove apiKey deprecated config option The `apiKey` was replaced with the `pushApiKey` config option some time ago. Remove the deprecated config option for the next major release. Part of #738 --- .changesets/remove-apikey-config-option.md | 6 ++++++ src/__tests__/config.test.ts | 16 ---------------- src/config.ts | 7 ------- src/config/options.ts | 1 - 4 files changed, 6 insertions(+), 24 deletions(-) create mode 100644 .changesets/remove-apikey-config-option.md diff --git a/.changesets/remove-apikey-config-option.md b/.changesets/remove-apikey-config-option.md new file mode 100644 index 00000000..b4017c65 --- /dev/null +++ b/.changesets/remove-apikey-config-option.md @@ -0,0 +1,6 @@ +--- +bump: "major" +type: "remove" +--- + +Remove the `apiKey` config option. This has been renamed to `pushApiKey`. diff --git a/src/__tests__/config.test.ts b/src/__tests__/config.test.ts index 8966c098..4d974a29 100644 --- a/src/__tests__/config.test.ts +++ b/src/__tests__/config.test.ts @@ -140,22 +140,6 @@ describe("Configuration", () => { }) }) - describe("apiKey option", () => { - it("sets the pushApiKey config option with the apiKey value", () => { - const warnMock = jest.spyOn(console, "warn").mockImplementation(() => {}) - const apiKey = "my key" - config = new Configuration({ apiKey }) - - expect(config.data.pushApiKey).toEqual(apiKey) - expect(config.data.apiKey).toBeUndefined() - expect(config.sources.initial.pushApiKey).toEqual(apiKey) - expect(config.sources.initial.apiKey).toBeUndefined() - expect(warnMock).toBeCalledWith( - "DEPRECATED: The `apiKey` config option was renamed to `pushApiKey`. Please rename the config option given to the Appsignal module." - ) - }) - }) - describe("logFilePath", () => { it("uses the default log file path", () => { jest.spyOn(fs, "accessSync").mockImplementation(() => {}) diff --git a/src/config.ts b/src/config.ts index 6dbad273..fabb3154 100644 --- a/src/config.ts +++ b/src/config.ts @@ -19,13 +19,6 @@ export class Configuration { sources: Record> constructor(options: Partial) { - if (options.apiKey) { - console.warn( - "DEPRECATED: The `apiKey` config option was renamed to `pushApiKey`. Please rename the config option given to the Appsignal module." - ) - options.pushApiKey = options.apiKey - delete options.apiKey - } this.sources = { default: this._defaultValues(), system: this._systemValues(), diff --git a/src/config/options.ts b/src/config/options.ts index cf0a5b48..526f067e 100644 --- a/src/config/options.ts +++ b/src/config/options.ts @@ -2,7 +2,6 @@ import type { DefaultInstrumentationName } from "../client" export type AppsignalOptions = { active: boolean - apiKey: string caFilePath: string disableDefaultInstrumentations: DefaultInstrumentationName[] | boolean dnsServers: string[]