mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-06-12 07:27:33 +01:00
Just saving latest changes.
This commit is contained in:
committed by
Craig Boger (from Dev Box)
parent
d720c56d48
commit
ec3dffb21c
+23
-17
@@ -149,21 +149,21 @@ export function client(): Cosmos.CosmosClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// find the ip address associated with the endpoint
|
// find the ip address associated with the endpoint
|
||||||
function findHostAddress(endpoint: string): Promise<string> {
|
// function findHostAddress(endpoint: string): Promise<string> {
|
||||||
return new Promise((resolve, reject) => {
|
// return new Promise((resolve, reject) => {
|
||||||
// Extract hostname from endpoint
|
// // Extract hostname from endpoint
|
||||||
const hostname = new URL(endpoint).hostname;
|
// const hostname = new URL(endpoint).hostname;
|
||||||
|
// const dns = require('dns');
|
||||||
// Use dns.lookup to find the IP address
|
// // Use dns.lookup to find the IP address
|
||||||
dns.lookup(hostname, (err, address) => {
|
// dns.lookup(hostname, (err, address) => {
|
||||||
if (err) {
|
// if (err) {
|
||||||
reject(err);
|
// reject(err);
|
||||||
} else {
|
// } else {
|
||||||
resolve(address);
|
// resolve(address);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Parsing out endpoint from diagnostics. Used to find address I need to add to firewall rule.
|
// Parsing out endpoint from diagnostics. Used to find address I need to add to firewall rule.
|
||||||
function parseEndpointFromDiag(json: string): string {
|
function parseEndpointFromDiag(json: string): string {
|
||||||
@@ -189,8 +189,9 @@ export function client(): Cosmos.CosmosClient {
|
|||||||
const regionalWriteEndpoint = await client.getWriteEndpoint();
|
const regionalWriteEndpoint = await client.getWriteEndpoint();
|
||||||
console.log(`Current write endpoint: ${JSON.stringify(regionalWriteEndpoint)}`);
|
console.log(`Current write endpoint: ${JSON.stringify(regionalWriteEndpoint)}`);
|
||||||
const parsedWriteEndpoint = parseEndpointFromDiag(JSON.stringify(regionalWriteEndpoint));
|
const parsedWriteEndpoint = parseEndpointFromDiag(JSON.stringify(regionalWriteEndpoint));
|
||||||
const writeHostAddress = await findHostAddress(parsedWriteEndpoint);
|
console.log(`Current parsed write endpoint: ${JSON.stringify(parsedWriteEndpoint)}`);
|
||||||
console.log(`Current write host address: ${JSON.stringify(writeHostAddress)}`);
|
// const writeHostAddress = await findHostAddress(parsedWriteEndpoint);
|
||||||
|
// console.log(`Current write host address: ${JSON.stringify(writeHostAddress)}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error getting read endpoints:", error);
|
console.error("Error getting read endpoints:", error);
|
||||||
}
|
}
|
||||||
@@ -201,8 +202,13 @@ export function client(): Cosmos.CosmosClient {
|
|||||||
|
|
||||||
const options: Cosmos.CosmosClientOptions = {
|
const options: Cosmos.CosmosClientOptions = {
|
||||||
endpoint: endpoint() || "https://cosmos.azure.com", // CosmosClient gets upset if we pass a bad URL. This should never actually get called
|
endpoint: endpoint() || "https://cosmos.azure.com", // CosmosClient gets upset if we pass a bad URL. This should never actually get called
|
||||||
|
// endpoint: "https://test-craig-nosql-periodic-eastus.documents.azure.com:443/",
|
||||||
key: userContext.masterKey,
|
key: userContext.masterKey,
|
||||||
tokenProvider,
|
tokenProvider,
|
||||||
|
connectionPolicy: {
|
||||||
|
enableEndpointDiscovery: true,
|
||||||
|
// preferredLocations: ["East US", "West US", "East US 2"],
|
||||||
|
},
|
||||||
userAgentSuffix: "Azure Portal",
|
userAgentSuffix: "Azure Portal",
|
||||||
defaultHeaders: _defaultHeaders,
|
defaultHeaders: _defaultHeaders,
|
||||||
connectionPolicy: {
|
connectionPolicy: {
|
||||||
|
|||||||
Reference in New Issue
Block a user