Fauna v10 .NET/C# Driver 1.0.1
 
Loading...
Searching...
No Matches
Endpoints.cs
Go to the documentation of this file.
1namespace Fauna.Core;
2
6public static class Endpoints
7{
11 public static Uri Default { get; } = new("https://db.fauna.com");
12
17 public static Uri GetFaunaEndpoint()
18 {
19 string? endpoint = Environment.GetEnvironmentVariable("FAUNA_ENDPOINT");
20 if (string.IsNullOrWhiteSpace(endpoint))
21 {
22 return Default;
23 }
24
25 if (Uri.IsWellFormedUriString(endpoint, UriKind.Absolute))
26 {
27 return new Uri(endpoint);
28 }
29
30 throw new UriFormatException("Invalid FAUNA_ENDPOINT environment variable. Must be a valid URI.");
31 }
32}