Change SonarqubeInfoProvider.getBaseUrl's signature

To make future changes to the API easier

Signed-off-by: Neemys <36508659+Neemys@users.noreply.github.com>
This commit is contained in:
Neemys
2022-07-28 17:45:36 +02:00
parent ae0e115dd1
commit 41d11ca579
2 changed files with 6 additions and 4 deletions
@@ -92,7 +92,9 @@ export async function createRouter(
);
}
response.send({
instanceUrl: sonarqubeInfoProvider.getBaseUrl(requestedInstanceKey),
instanceUrl: sonarqubeInfoProvider.getBaseUrl({
instanceName: requestedInstanceKey,
}).baseUrl,
});
}) as RequestHandler<unknown, { instanceUrl: string }, unknown, { instanceKey: string }>);
@@ -30,7 +30,7 @@ export interface SonarqubeInfoProvider {
* @param instanceName - Name of the sonarqube instance to get the info from
* @returns the url of the instance
*/
getBaseUrl(instanceName: string): string;
getBaseUrl({ instanceName }: { instanceName: string }): { baseUrl: string };
/**
* Query the sonarqube instance corresponding to the instanceName to get all
@@ -295,9 +295,9 @@ export class DefaultSonarqubeInfoProvider implements SonarqubeInfoProvider {
* {@inheritDoc SonarqubeInfoProvider.getBaseUrl}
* @throws Error If configuration can't be retrieved.
*/
getBaseUrl(instanceName: string): string {
getBaseUrl({ instanceName }: { instanceName: string }): { baseUrl: string } {
const instanceConfig = this.config.getInstanceConfig(instanceName ?? '');
return instanceConfig.baseUrl;
return { baseUrl: instanceConfig.baseUrl };
}
/**