Skip to content

Commit 9f5d53d

Browse files
committed
resolve comments and update vulnerable dependency
1 parent 8c5935d commit 9f5d53d

File tree

2 files changed

+36
-29
lines changed

2 files changed

+36
-29
lines changed

package-lock.json

Lines changed: 23 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ConfigurationClientManager.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import * as RequestTracing from "./requestTracing/constants";
1111
const TCP_ORIGIN = "_origin._tcp";
1212
const ALT = "_alt";
1313
const TCP = "_tcp";
14-
const EndpointSection = "Endpoint";
15-
const IdSection = "Id";
16-
const SecretSection = "Secret";
14+
const Endpoint = "Endpoint";
15+
const Id = "Id";
16+
const Secret = "Secret";
1717
const AzConfigDomainLabel = ".azconfig.";
1818
const AppConfigDomainLabel = ".appconfig.";
1919
const FallbackClientRefreshExpireInterval = 60 * 60 * 1000; // 1 hour in milliseconds
@@ -51,10 +51,10 @@ export class ConfigurationClientManager implements IConfigurationClientManager {
5151
options = credentialOrOptions as AzureAppConfigurationOptions;
5252
this.#clientOptions = getClientOptions(options);
5353
staticClient = new AppConfigurationClient(connectionString, this.#clientOptions);
54-
this.#secret = parseConnectionString(connectionString, SecretSection);
55-
this.#id = parseConnectionString(connectionString, IdSection);
54+
this.#secret = parseConnectionString(connectionString, Secret);
55+
this.#id = parseConnectionString(connectionString, Id);
5656
// TODO: need to check if it's CDN or not
57-
this.endpoint = parseConnectionString(connectionString, EndpointSection);
57+
this.endpoint = parseConnectionString(connectionString, Endpoint);
5858

5959
} else if (connectionStringOrEndpoint instanceof URL) {
6060
const credential = credentialOrOptions as TokenCredential;
@@ -173,7 +173,7 @@ async function querySrvTargetHost(host) {
173173
if (isFailoverableEnv()) {
174174
dns = require("dns/promises");
175175
} else {
176-
return results;
176+
throw new Error("Failover is not supported in the current environment.");
177177
}
178178

179179
try {
@@ -215,7 +215,11 @@ async function querySrvTargetHost(host) {
215215
}
216216
}
217217
} catch (err) {
218-
throw new Error(`Failed to lookup origin SRV records: ${err.message}`);
218+
if (err.code === "ENOTFOUND") {
219+
return results; // No SRV records found, return empty array
220+
} else {
221+
throw new Error(`Failed to lookup SRV records: ${err.message}`);
222+
}
219223
}
220224

221225
return results;
@@ -264,7 +268,7 @@ function buildConnectionString(endpoint, secret, id) {
264268
return "";
265269
}
266270

267-
return `${EndpointSection}=${endpoint};${IdSection}=${id};${SecretSection}=${secret}`;
271+
return `${Endpoint}=${endpoint};${Id}=${id};${Secret}=${secret}`;
268272
}
269273

270274
/**

0 commit comments

Comments
 (0)