Skip to content

Commit

Permalink
Add WriteWarning to system provider.
Browse files Browse the repository at this point in the history
  • Loading branch information
dnwpark committed Jan 24, 2025
1 parent ac6da4d commit ba659af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/EdgeDB.Net.Driver/Models/ISystemProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ internal interface ISystemProvider
string? GetEnvVariable(string name);
bool FileExists(string path);
string FileReadAllText(string path);
void WriteWarning(string message);

public virtual bool GetGelEnvVariable(string key, out string name, out string value)
{
Expand All @@ -27,7 +28,7 @@ public virtual bool GetGelEnvVariable(string key, out string name, out string va
string? gelVal = GetEnvVariable(gelKey);
if (edgedbVal is not null && gelVal is not null)
{
Console.WriteLine($"Both GEL_{key} and EDGEDB_{key} are set; EDGEDB_{key} will be ignored");
WriteWarning($"Both GEL_{key} and EDGEDB_{key} are set; EDGEDB_{key} will be ignored");
}

if (gelVal is not null)
Expand Down Expand Up @@ -88,6 +89,9 @@ public virtual bool FileExists(string path)

public virtual string FileReadAllText(string path)
=> File.ReadAllText(path);

public virtual void WriteWarning(string message)
=> Console.WriteLine(message);
}

internal sealed class DefaultSystemProvider : BaseDefaultSystemProvider
Expand Down
3 changes: 3 additions & 0 deletions tests/EdgeDB.Tests.Unit/ProjectPathHashingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,8 @@ public bool FileExists(string path)

public string FileReadAllText(string path)
=> File.ReadAllText(path);

public virtual void WriteWarning(string message)
=> Console.WriteLine(message);
}
}

0 comments on commit ba659af

Please sign in to comment.