Skip to content

Commit

Permalink
Merge pull request #5 from DFEAGILEDEVOPS/tech-debt/merge-to-master
Browse files Browse the repository at this point in the history
Merge `develop` to `master`
  • Loading branch information
WolfyUK authored Feb 29, 2024
2 parents 0d4374e + eab4c86 commit 66d36fa
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 11 deletions.
14 changes: 7 additions & 7 deletions API/SFB.Web.Api/SFB.Web.Api.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<UserSecretsId>f89b61bc-9dd8-474e-ab38-33a08145edbb</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.14.0-beta3" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.7.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="SFB.Artifacts.ApplicationCore" Version="1.0.72.73892" />
<PackageReference Include="SFB.Artifacts.Infrastructure" Version="1.0.348.71799" />
<PackageReference Include="StackExchange.Redis" Version="2.2.88" />
<PackageReference Include="SFB.Artifacts.ApplicationCore" Version="1.2024.37.79737" />
<PackageReference Include="SFB.Artifacts.Infrastructure" Version="1.2024.45.79895" />
<PackageReference Include="StackExchange.Redis" Version="2.7.17" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.16" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Runtime.Caching" Version="6.0.0" />
</ItemGroup>
</Project>
9 changes: 6 additions & 3 deletions API/SFB.Web.Api/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using SFB.Web.Infrastructure.Repositories;
using System;
using StackExchange.Redis;
using Microsoft.Azure.Cosmos;

namespace SFB.Web.Api
{
Expand All @@ -38,12 +39,14 @@ public void ConfigureServices(IServiceCollection services)
string redisConnectionString = Configuration.GetValue<string>("Secrets:redisConnectionString");
string sadSizeLookupCollectionId = Configuration.GetValue<string>("Secrets:sadSizeLookupCollection");
string sadFSMLookupCollectionId = Configuration.GetValue<string>("Secrets:sadFSMLookupCollection");
string cosmosConnectionMode = Configuration.GetValue<string>("Secrets:cosmosConnectionMode");
string enableAiTelemetry = Configuration.GetValue<string>("ApplicationInsights:enabled");
string aiKey = Configuration.GetValue<string>("ApplicationInsights:InstrumentationKey");

var cosmosClient = new CosmosClientBuilder(endPoint, authKey)
.WithConnectionModeDirect()
.Build();
var cosmosClientBuilder = new CosmosClientBuilder(endPoint, authKey);
var cosmosClient = cosmosConnectionMode == "Gateway"
? cosmosClientBuilder.WithConnectionModeGateway().Build()
: cosmosClientBuilder.WithConnectionModeDirect().Build();

var dataCollectionManager = new DataCollectionManager(cosmosClient, databaseId, new NetCoreCachedActiveCollectionsService());

Expand Down
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,33 @@ The API has been integrated into the existing SFB infrastructure and is being co

Additional consolidation and functional specification is in progress.

New upload 14/11/23
## Local development

Install the prerequisites:

1. .NET 6
1. [Docker](https://docs.docker.com/get-docker/)

You will also need to authenticate with Azure DevOps in order to resolve packages from the private package feed.

Right-click on project in Visual Studio and select Manage User Secrets or in Rider, click Tools > Manage .NET Secrets. Populate the following in the `secrets.json` file:

```json
{
"Secrets:endpoint": "https://cm-t1dv-sfb.documents.azure.com:443/",
"Secrets:authkey": "•••",
"Secrets:database": "sfb-dev",
"Secrets:emCollection": "20210318000000-EM-2021-2022",
"Secrets:sadCollection": "SADBandingTest",
"Secrets:redisConnectionString": "127.0.0.1:6379",
"Secrets:sadSizeLookupCollection": "SizelookupTest",
"Secrets:sadFSMLookupCollection": "FSMlookupTest",
"Secrets:cosmosConnectionMode": "Gateway"
}
```

To start the local Redis container run:

```bash
​​docker-compose up
```
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '3.8'
services:
cache:
image: redis:7.2.4-alpine
restart: always
ports:
- '6379:6379'
command: redis-server --save 20 1 --loglevel warning
volumes:
- cache:/data
volumes:
cache:
driver: local

0 comments on commit 66d36fa

Please sign in to comment.