Skip to content

Commit c10955a

Browse files
authored
chore: validate apiBaseUrl (#575)
1 parent 430f427 commit c10955a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/server.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,13 @@ export class Server {
239239
// Validate API client credentials
240240
if (this.userConfig.apiClientId && this.userConfig.apiClientSecret) {
241241
try {
242+
if (!this.userConfig.apiBaseUrl.startsWith("https://")) {
243+
const message =
244+
"Failed to validate MongoDB Atlas the credentials from config: apiBaseUrl must start with https://";
245+
console.error(message);
246+
throw new Error(message);
247+
}
248+
242249
await this.session.apiClient.validateAccessToken();
243250
} catch (error) {
244251
if (this.userConfig.connectionString === undefined) {

0 commit comments

Comments
 (0)