Skip to content

Commit

Permalink
Upgrade LocalTest to .net 6.0. (#8485)
Browse files Browse the repository at this point in the history
* Upgrade LocalTest to .net 6.0.

* Update dotnet sdk in analysis workflow
  • Loading branch information
SandGrainOne authored Jun 30, 2022
1 parent 43ec5ab commit 5d23229
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine AS build
WORKDIR /LocalTest

COPY ./LocalTest/LocalTest.csproj /LocalTest
Expand All @@ -11,7 +11,7 @@ RUN ls /
RUN dotnet build LocalTest.csproj -c Release -o /app_output
RUN dotnet publish LocalTest.csproj -c Release -o /app_output

FROM mcr.microsoft.com/dotnet/aspnet:5.0-alpine AS final
FROM mcr.microsoft.com/dotnet/aspnet:6.0-alpine AS final
EXPOSE 5101
WORKDIR /app
COPY --from=build /app_output .
Expand Down
2 changes: 1 addition & 1 deletion src/LocalTest.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<UserSecretsId>56f36ce2-b44b-415e-a8a5-f399a76e35b9</UserSecretsId>
</PropertyGroup>

Expand Down
6 changes: 0 additions & 6 deletions src/Program.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace LocalTest
{
Expand Down
23 changes: 15 additions & 8 deletions src/Services/Storage/Implementation/ApplicationRepository.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
using Altinn.Platform.Storage.Interface.Models;
using Altinn.Platform.Storage.Repository;
using LocalTest.Configuration;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading.Tasks;

using Altinn.Platform.Storage.Interface.Models;
using Altinn.Platform.Storage.Repository;

using LocalTest.Configuration;

using Microsoft.Extensions.Options;

namespace LocalTest.Services.Storage.Implementation
{
public class ApplicationRepository : IApplicationRepository
Expand Down Expand Up @@ -65,7 +67,12 @@ public async Task<List<Application>> FindByOrg(string org)
public async Task<Application> Update(Application item)
{
Directory.CreateDirectory(GetApplicationsDirectory()+item.Id.Split('/')[0]);
await File.WriteAllTextAsync(GetApplicationsDirectory() + item.Id + ".json", JsonSerializer.Serialize(item, new() { WriteIndented = true, DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull }));
JsonSerializerOptions options = new JsonSerializerOptions
{
WriteIndented = true,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
};
await File.WriteAllTextAsync(GetApplicationsDirectory() + item.Id + ".json", JsonSerializer.Serialize(item, options));
return item;
}

Expand All @@ -87,7 +94,7 @@ public Task<Dictionary<string, string>> GetAllAppTitles()

public string GetApplicationsDirectory()
{
return _localPlatformSettings.LocalTestingStorageBasePath + _localPlatformSettings.DocumentDbFolder + _localPlatformSettings.ApplicationsDataFolder;
return Path.Join(_localPlatformSettings.LocalTestingStorageBasePath, _localPlatformSettings.DocumentDbFolder, _localPlatformSettings.ApplicationsDataFolder);
}
}
}
4 changes: 0 additions & 4 deletions src/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}

},
"AllowedHosts": "*",
"LocalPlatformSettings": {
Expand All @@ -48,8 +47,5 @@
},
"PlatformSettings": {
"ApiAuthorizationEndpoint": "http://localhost:5101/authorization/api/v1/"
},
"PepSettings": {
"DisablePEP": "false"
}
}

0 comments on commit 5d23229

Please sign in to comment.