Skip to content

Commit

Permalink
Upgrade Fauna driver to 1.0.1 (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
pnwpedro authored Nov 15, 2024
1 parent 585182d commit da63957
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
6 changes: 4 additions & 2 deletions DotNetSampleApp.Tests/TestSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ public void SetupOnce()
{
if (Environment.GetEnvironmentVariable("FAUNA_SECRET") == null)
{
var c = new Client(new Configuration("secret")
var c = new Client(new Configuration
{
Secret = "secret",
Endpoint = new Uri("http://localhost:8443"),
});
Secret = c.QueryAsync<string>(Query.FQL($$"""
Expand All @@ -29,8 +30,9 @@ public void SetupOnce()
Secret = Environment.GetEnvironmentVariable("FAUNA_SECRET")!;
}

Client = new Client(new Configuration(Secret)
Client = new Client(new Configuration
{
Secret = Secret,
Endpoint = new Uri("http://localhost:8443"),
});

Expand Down
2 changes: 1 addition & 1 deletion DotNetSampleApp/DotNetSampleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Fauna" Version="0.5.0-beta" />
<PackageReference Include="Fauna" Version="1.0.1" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.5" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>
Expand Down
8 changes: 1 addition & 7 deletions DotNetSampleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@

builder.Services.AddSingleton<Client>(_ =>
{
var secret = Environment.GetEnvironmentVariable("FAUNA_SECRET");
if (string.IsNullOrEmpty(secret))
{
throw new InvalidOperationException("Required environment variable not set: FAUNA_SECRET");
}
var client = new Client(secret);
var client = new Client();
SeedService.Init(client);
return client;
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,3 +393,10 @@ Customer documents and related API responses:
2. Start Fauna in a container: `docker run --rm --name fauna -p 8443:8443 -p 8084:8084 fauna/faunadb`
3. Configure the schema: `./setup-local.sh`
4. Run tests: `dotnet test`

### dotnet run with local Fauna
1. Start Fauna in a container: `docker run --rm --name fauna -p 8443:8443 -p 8084:8084 fauna/faunadb`
2. Configure the schema: `./setup-local.sh`
2. Copy the secret returned from running `./setup-local.sh`
2. `cd DotNetSampleApp`
3. `FAUNA_SECRET="<SECRET>" FAUNA_ENDPOINT="http://localhost:8443" dotnet run`

0 comments on commit da63957

Please sign in to comment.