Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into version-0.18.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Borewit committed Aug 31, 2024
2 parents 31aaadd + 974cf50 commit 9fb3f3e
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions lib/musicbrainz-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export interface IMusicBrainzConfig {
username?: string,
password?: string
},
baseUrl: string,
baseUrl?: string,

appName?: string,
appVersion?: string,
Expand All @@ -149,6 +149,10 @@ export interface IMusicBrainzConfig {
disableRateLimiting?: boolean
}

interface IInternalConfig extends IMusicBrainzConfig {
baseUrl: string,
}

export interface ICsrfSession {
sessionKey: string;
token: string;
Expand All @@ -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;
Expand All @@ -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,
Expand Down

0 comments on commit 9fb3f3e

Please sign in to comment.