Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillKurdyukov committed Aug 13, 2024
1 parent 6c9a29a commit 7393228
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions slo/src/AdoNet/SloContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,18 @@ protected override Task CleanUp(string dropTableSql, int operationTimeout)

public override Task<YdbDataSource> CreateClient(Config config)
{
var endpointWithoutSchema = config.Endpoint.Split("://")[1];
var hostAndPort = endpointWithoutSchema.Split(":");
var splitEndpoint = config.Endpoint.Split("://");
var useTls = splitEndpoint[0] switch
{
"grpc" => false,
"grpcs" => true,
_ => throw new ArgumentException("Don't support schema: " + splitEndpoint[0])
};

var host = splitEndpoint[1].Split(":")[0];
var port = splitEndpoint[1].Split(":")[1];

return Task.FromResult(new YdbDataSource(new YdbConnectionStringBuilder
{ Host = hostAndPort[0], Port = int.Parse(hostAndPort[1]), Database = config.Db }));
{ UseTls = useTls, Host = host, Port = int.Parse(port), Database = config.Db }));
}
}

0 comments on commit 7393228

Please sign in to comment.