Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
dnwpark committed Nov 29, 2024
1 parent 0bae0fa commit ca5d3d8
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/driver/src/baseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,10 @@ export abstract class BaseClientPool {
throw new errors.InterfaceError("The client is closed");
}

console.log("! getNewConnection");
console.log(this.__normalizedConnectConfig);
const config = await this._getNormalizedConnectConfig();
console.log(config.connectionParams);
const connection = await retryingConnect(
this._connectWithTimeout,
config,
Expand Down
3 changes: 3 additions & 0 deletions packages/driver/src/browserClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export function createClient(): Client {
export function createHttpClient(
options?: string | ConnectOptions | null,
): Client {
console.log("! createHttpClient");
console.log(". options");
console.log(options);
return new Client(
new FetchClientPool(
parseConnectArguments,
Expand Down
39 changes: 38 additions & 1 deletion packages/driver/src/conUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,13 @@ async function parseConnectDsnAndArgs(
config: ConnectConfig,
serverUtils: ServerUtils | null,
): Promise<PartiallyNormalizedConfig> {
console.log("! parseConnectDsnAndArgs");
console.log(". config.tlsCA");
console.log(config.tlsCA);
console.log(". config.tlsCAFile");
console.log(config.tlsCAFile);
console.log(getEnv("EDGEDB_TLS_CA_FILE"));

const resolvedConfig = new ResolvedConnectConfig();
let fromEnv = false;
let fromProject = false;
Expand Down Expand Up @@ -805,6 +812,9 @@ async function resolveConfigOptions<
}
}

console.warn("! resolveConfigOptions");
console.log(". resolvedConfig._tlsCAData");
console.log(resolvedConfig._tlsCAData);
anyOptionsUsed =
resolvedConfig.setUser(config.user ?? null, sources.user!) ||
anyOptionsUsed;
Expand All @@ -819,15 +829,32 @@ async function resolveConfigOptions<
config.cloudProfile ?? null,
sources.cloudProfile!,
) || anyOptionsUsed;
console.log(": 1");
console.log(". resolvedConfig._tlsCAData");
console.log(resolvedConfig._tlsCAData);
console.log(". config.tlsCAFile");
console.log(config.tlsCA);
console.log(". sources.tlsCA");
console.log(sources.tlsCA);
anyOptionsUsed =
resolvedConfig.setTlsCAData(config.tlsCA ?? null, sources.tlsCA!) ||
anyOptionsUsed;
console.log(": 2");
console.log(". resolvedConfig._tlsCAData");
console.log(resolvedConfig._tlsCAData);
console.log(". config.tlsCAFile");
console.log(config.tlsCAFile);
console.log(". sources.tlsCAFile");
console.log(sources.tlsCAFile);
anyOptionsUsed =
(await resolvedConfig.setTlsCAFile(
config.tlsCAFile ?? null,
sources.tlsCAFile!,
readFile,
)) || anyOptionsUsed;
console.log(": 3");
console.log(". resolvedConfig._tlsCAData");
console.log(resolvedConfig._tlsCAData);
anyOptionsUsed =
resolvedConfig.setTlsServerName(
config.tlsServerName ?? null,
Expand Down Expand Up @@ -869,8 +896,11 @@ async function resolveConfigOptions<
resolvedConfig.setPort(config.port, sources.port!);
}
const host = config.host != null ? validateHost(config.host) : "";
dsn = `edgedb://${host.includes(":") ? `[${encodeURI(host)}]` : host}`;
dsn = `gel://${host.includes(":") ? `[${encodeURI(host)}]` : host}`;
}
console.log(": 4");
console.log(". resolvedConfig._tlsCAData");
console.log(resolvedConfig._tlsCAData);
await parseDSNIntoConfig(
dsn,
resolvedConfig,
Expand Down Expand Up @@ -972,6 +1002,11 @@ async function parseDSNIntoConfig(
);
}

console.log("!!! parseDSNIntoConfig");
console.log(". dsnString");
console.log(dsnString);
console.log(". _tlsCAData");
console.log(config._tlsCAData);
let parsed: URL;
try {
parsed = new URL(dsnString);
Expand Down Expand Up @@ -1125,6 +1160,8 @@ async function parseDSNIntoConfig(
config.setSecretKey,
);

console.log(". _tlsCAData");
console.log(config._tlsCAData);
await handleDSNPart("tls_ca", null, config._tlsCAData, config.setTlsCAData);
await handleDSNPart(
"tls_ca_file",
Expand Down
2 changes: 2 additions & 0 deletions packages/driver/src/httpScram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ export function getHTTPSCRAMAuth(cryptoUtils: CryptoUtils): HttpSCRAMAuth {
serverNonce,
);

console.log("!!! getHTTPSCRAMAuth");
console.log(authUrl);
const serverFinalRes = await fetch(authUrl, {
headers: {
Authorization: `SCRAM-SHA-256 sid=${sid}, data=${utf8ToB64(
Expand Down
4 changes: 4 additions & 0 deletions packages/driver/src/nodeClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ class ClientPool extends BaseClientPool {
}

export function createClient(options?: string | ConnectOptions | null): Client {
console.log("! createClient");
console.log(". options");
console.log(options);
return new Client(
new ClientPool(
parseConnectArguments,
Expand All @@ -31,6 +34,7 @@ class FetchClientPool extends BaseClientPool {
export function createHttpClient(
options?: string | ConnectOptions | null,
): Client {
console.log("! createHttpClient");
return new Client(
new FetchClientPool(
parseConnectArguments,
Expand Down

0 comments on commit ca5d3d8

Please sign in to comment.