Skip to content

Commit

Permalink
make IMusicBrainzConfig.baseUrl optional again (#976)
Browse files Browse the repository at this point in the history
Make `baseUrl` optional again
  • Loading branch information
Haschikeks authored Aug 28, 2024
1 parent b0c2f83 commit 974cf50
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 974cf50

Please sign in to comment.