Skip to content

Commit

Permalink
Add gel as a valid dsn scheme.
Browse files Browse the repository at this point in the history
  • Loading branch information
dnwpark committed Nov 28, 2024
1 parent 62b6474 commit bfb10ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/EdgeDB.Net.Driver/EdgeDBConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ internal bool ValidateServerCertificateCallback(object sender, X509Certificate?
/// <inheritdoc />
public override string ToString()
{
var str = "edgedb://";
var str = "gel://";

if (Username is not null)
str += Username;
Expand Down Expand Up @@ -269,8 +269,8 @@ public string CloudProfile
/// <exception cref="KeyNotFoundException">An environment variable couldn't be found.</exception>
public static EdgeDBConnection FromDSN(string dsn)
{
if (!dsn.StartsWith("edgedb://"))
throw new ConfigurationException("DSN schema 'edgedb' expected but got 'pq'");
if (!dsn.StartsWith("edgedb://") && !dsn.StartsWith("gel://"))
throw new ConfigurationException("DSN schema 'gel' expected but got 'pq'");

string? database = null, username = null, port = null, host = null, password = null;

Expand Down Expand Up @@ -644,7 +644,7 @@ public static EdgeDBConnection Parse(string? instance = null, string? dsn = null

// try to resolve the toml, don't do this for cloud-like conn params.
if (autoResolve && !((instance is not null && instance.Contains('/')) ||
(dsn is not null && !dsn.StartsWith("edgedb://"))))
(dsn is not null && !dsn.StartsWith("edgedb://") && !dsn.StartsWith("gel://"))))
{
try
{
Expand Down
2 changes: 1 addition & 1 deletion tests/EdgeDB.Tests.Unit/ConnectionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void DSNWithUnixSocket() =>
[TestMethod]
public void DSNRequiresEdgeDBSchema() =>
ExpectError<ConfigurationException>(ParseConnection("pq:///dbname?host=/unix_sock/test&user=spam"),
"DSN schema 'edgedb' expected but got 'pq'");
"DSN schema 'gel' expected but got 'pq'");

[TestMethod]
public void DSNQueryParameterWithUnixSocket() =>
Expand Down

0 comments on commit bfb10ba

Please sign in to comment.