diff --git a/lib/musicbrainz-api.ts b/lib/musicbrainz-api.ts index 0263cfc7..49888081 100644 --- a/lib/musicbrainz-api.ts +++ b/lib/musicbrainz-api.ts @@ -131,7 +131,7 @@ export interface IMusicBrainzConfig { username?: string, password?: string }, - baseUrl: string, + baseUrl?: string, appName?: string, appVersion?: string, @@ -149,6 +149,10 @@ export interface IMusicBrainzConfig { disableRateLimiting?: boolean } +interface IInternalConfig extends IMusicBrainzConfig { + baseUrl: string, +} + export interface ICsrfSession { sessionKey: string; token: string; @@ -161,9 +165,7 @@ export interface ISessionInformation { export class MusicBrainzApi { - public readonly config: IMusicBrainzConfig = { - baseUrl: 'https://musicbrainz.org' - }; + public readonly config: IInternalConfig; private rateLimiter: RateLimitThreshold; private httpClient: HttpClient; @@ -190,7 +192,12 @@ export class MusicBrainzApi { public constructor(_config?: IMusicBrainzConfig) { - Object.assign(this.config, _config); + this.config = { + ...{ + baseUrl: 'https://musicbrainz.org' + }, + ..._config + } this.httpClient = new HttpClient({ baseUrl: this.config.baseUrl,