Skip to content

Commit

Permalink
Remove apiKey deprecated config option
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tombruijn committed Oct 5, 2022
1 parent 2b95a68 commit 13bc306
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 24 deletions.
6 changes: 6 additions & 0 deletions .changesets/remove-apikey-config-option.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
bump: "major"
type: "remove"
---

Remove the `apiKey` config option. This has been renamed to `pushApiKey`.
16 changes: 0 additions & 16 deletions src/__tests__/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {})
Expand Down
7 changes: 0 additions & 7 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ export class Configuration {
sources: Record<string, Partial<AppsignalOptions>>

constructor(options: Partial<AppsignalOptions>) {
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(),
Expand Down
1 change: 0 additions & 1 deletion src/config/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { DefaultInstrumentationName } from "../client"

export type AppsignalOptions = {
active: boolean
apiKey: string
caFilePath: string
disableDefaultInstrumentations: DefaultInstrumentationName[] | boolean
dnsServers: string[]
Expand Down

0 comments on commit 13bc306

Please sign in to comment.