Skip to content

Commit 4ed55f8

Browse files
Merge pull request #13 from microting/master
Master changes
2 parents fc0cd26 + 8daebb5 commit 4ed55f8

22 files changed

+717
-704
lines changed

.github/workflows/dotnet-core-master.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ jobs:
170170
- name: Setup .NET Core
171171
uses: actions/setup-dotnet@v3
172172
with:
173-
dotnet-version: 9.0.x
173+
dotnet-version: 10.0.x
174174
- name: Install dependencies
175175
run: dotnet restore eFormAPI/eFormAPI.sln
176176
- name: Build

.github/workflows/dotnet-core-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ jobs:
169169
- name: Setup .NET Core
170170
uses: actions/setup-dotnet@v3
171171
with:
172-
dotnet-version: 9.0.x
172+
dotnet-version: 10.0.x
173173
- name: Install dependencies
174174
run: dotnet restore eFormAPI/eFormAPI.sln
175175
- name: Build

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ RUN yarn install
1111
RUN yarn build
1212
RUN if [ -n "$SENTRY_AUTH_TOKEN" ] && [ "$DISABLE_SENTRY" != "true" ]; then yarn sentrysourcemap; else echo "Sentry sourcemap upload skipped (DISABLE_SENTRY=$DISABLE_SENTRY)"; fi
1313

14-
FROM mcr.microsoft.com/dotnet/sdk:9.0-noble AS build-env
14+
FROM mcr.microsoft.com/dotnet/sdk:10.0-noble AS build-env
1515
WORKDIR /app
1616
ARG GITVERSION
1717
ARG DISABLE_SENTRY
@@ -22,7 +22,7 @@ RUN dotnet publish -o out /p:Version=$GITVERSION --runtime linux-x64 --configura
2222
RUN pwd
2323

2424
# Build runtime image
25-
FROM mcr.microsoft.com/dotnet/aspnet:9.0-noble
25+
FROM mcr.microsoft.com/dotnet/aspnet:10.0-noble
2626
WORKDIR /app
2727
ARG DISABLE_SENTRY
2828
ENV DISABLE_SENTRY=${DISABLE_SENTRY}

Dockerfile-big

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ COPY eform-client ./
55
RUN npm install
66
RUN npm run build
77

8-
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env
8+
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build-env
99
WORKDIR /app
1010
ARG GITVERSION
1111

@@ -15,7 +15,7 @@ RUN dotnet publish -o out /p:Version=$GITVERSION --runtime linux-x64 --configura
1515
RUN pwd
1616

1717
# Build runtime image
18-
FROM mcr.microsoft.com/dotnet/aspnet:7.0
18+
FROM mcr.microsoft.com/dotnet/aspnet:10.0
1919
WORKDIR /app
2020
COPY --from=build-env /app/out .
2121
COPY --from=node-env /app/dist wwwroot

eFormAPI/eFormAPI.Web.Integration.Tests/eFormAPI.Web.Integration.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net9.0</TargetFramework>
5+
<TargetFramework>net10.0</TargetFramework>
66
<IsPublishable>false</IsPublishable>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
1111
<PackageReference Include="NUnit" Version="4.4.0" />
1212
<PackageReference Include="NUnit.Analyzers" Version="4.11.2">
1313
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

eFormAPI/eFormAPI.Web.Tests/eFormAPI.Web.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net9.0</TargetFramework>
5+
<TargetFramework>net10.0</TargetFramework>
66
<IsPublishable>false</IsPublishable>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
1111
<PackageReference Include="NUnit" Version="4.4.0" />
1212
<PackageReference Include="NUnit.Analyzers" Version="4.11.2">
1313
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

eFormAPI/eFormAPI.Web/Program.cs

Lines changed: 79 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ namespace eFormAPI.Web;
4343
using Hosting.Helpers;
4444
using Hosting.Helpers.DbOptions;
4545
using Hosting.Settings;
46-
using Microsoft.AspNetCore;
4746
using Microsoft.AspNetCore.Hosting;
47+
using Microsoft.Extensions.Hosting;
4848
using Microsoft.Extensions.Configuration;
4949
using Microsoft.Extensions.DependencyInjection;
5050
using Microsoft.Extensions.Logging;
@@ -147,9 +147,9 @@ public static void Stop()
147147

148148
// public static ReloadDbConfiguration ReloadDbConfigurationDelegate { get; set; }
149149

150-
public static async void LoadNavigationMenuEnabledPlugins(IWebHost webHost)
150+
public static async void LoadNavigationMenuEnabledPlugins(IHost host)
151151
{
152-
using var scope = webHost.Services.GetService<IServiceScopeFactory>().CreateScope();
152+
using var scope = host.Services.GetService<IServiceScopeFactory>().CreateScope();
153153
BaseDbContext dbContext = null;
154154
try
155155
{
@@ -182,9 +182,9 @@ public static async void LoadNavigationMenuEnabledPlugins(IWebHost webHost)
182182
}
183183
}
184184

185-
public static void MigrateDb(IWebHost webHost)
185+
public static void MigrateDb(IHost host)
186186
{
187-
using var scope = webHost.Services.GetService<IServiceScopeFactory>().CreateScope();
187+
using var scope = host.Services.GetService<IServiceScopeFactory>().CreateScope();
188188
BaseDbContext dbContext = null;
189189
try
190190
{
@@ -274,9 +274,9 @@ public static void MigrateDb(IWebHost webHost)
274274
}
275275
}
276276

277-
private static async Task InitializeSettings(IWebHost webHost, string[] args)
277+
private static async Task InitializeSettings(IHost host, string[] args)
278278
{
279-
using var scope = webHost.Services.GetService<IServiceScopeFactory>().CreateScope();
279+
using var scope = host.Services.GetService<IServiceScopeFactory>().CreateScope();
280280
var settingsService = scope.ServiceProvider.GetRequiredService<ISettingsService>();
281281
var existsResult = settingsService.ConnectionStringExist();
282282
if(!existsResult.Success)// do need to initialize database
@@ -407,7 +407,7 @@ await SeedAdminHelper.SeedAdmin(adminSetupModel,
407407
}
408408
}
409409

410-
private static IWebHost BuildWebHost(string[] args)
410+
private static IHost BuildWebHost(string[] args)
411411
{
412412
Console.WriteLine("BuildWebHost");
413413
// print all args
@@ -480,93 +480,96 @@ private static IWebHost BuildWebHost(string[] args)
480480
Environment.SetEnvironmentVariable("PROJECT_ID", projectId);
481481
Console.WriteLine("PROJECT_ID: " + projectId);
482482

483-
return WebHost.CreateDefaultBuilder(args)
484-
.ConfigureKestrel(serverOptions =>
483+
return Host.CreateDefaultBuilder(args)
484+
.ConfigureWebHostDefaults(webBuilder =>
485485
{
486-
serverOptions.Limits.MaxRequestBodySize = 100 * 1024 * 1024;// 100Mb
487-
})
488-
.UseUrls($"http://0.0.0.0:{port}")
489-
// .UseIISIntegration()
490-
.ConfigureAppConfiguration((hostContext, config) =>
491-
{
492-
Log.LogEvent("Delete all default configuration providers");
493-
// delete all default configuration providers
494-
config.Sources.Clear();
495-
config.SetBasePath(hostContext.HostingEnvironment.ContentRootPath);
496-
497-
var filePath = Path.Combine(hostContext.HostingEnvironment.ContentRootPath,
498-
"connection.json");
499-
500-
if (!File.Exists(filePath))
486+
webBuilder.ConfigureKestrel(serverOptions =>
501487
{
502-
ConnectionStringManager.CreateDefault(filePath);
503-
}
504-
505-
if (!string.IsNullOrEmpty(connectionString))
488+
serverOptions.Limits.MaxRequestBodySize = 100 * 1024 * 1024;// 100Mb
489+
})
490+
.UseUrls($"http://0.0.0.0:{port}")
491+
// .UseIISIntegration()
492+
.ConfigureAppConfiguration((hostContext, config) =>
506493
{
507-
Log.LogEvent($"Creating ConnectionString file with the ConnectionString: {connectionString}");
508-
ConnectionStringManager.CreateWithConnectionString(filePath, connectionString);
509-
}
494+
Log.LogEvent("Delete all default configuration providers");
495+
// delete all default configuration providers
496+
config.Sources.Clear();
497+
config.SetBasePath(hostContext.HostingEnvironment.ContentRootPath);
510498

511-
config.AddJsonFile("connection.json", optional: true, reloadOnChange: true);
512-
var mainSettings = ConnectionStringManager.Read(filePath);
513-
_defaultConnectionString = mainSettings?.ConnectionStrings?.DefaultConnection;
514-
config.AddEfConfiguration(_defaultConnectionString);
515-
EnabledPlugins = PluginHelper.GetPlugins(_defaultConnectionString);
516-
DisabledPlugins = PluginHelper.GetDisablePlugins(_defaultConnectionString);
499+
var filePath = Path.Combine(hostContext.HostingEnvironment.ContentRootPath,
500+
"connection.json");
517501

518-
var contextFactory = new BaseDbContextFactory();
519-
if (_defaultConnectionString != "...")
520-
{
521-
string pattern = @"Database=(\d+)_Angular;";
522-
Match match = Regex.Match(_defaultConnectionString!, pattern);
502+
if (!File.Exists(filePath))
503+
{
504+
ConnectionStringManager.CreateDefault(filePath);
505+
}
523506

524-
if (match.Success)
507+
if (!string.IsNullOrEmpty(connectionString))
525508
{
526-
string numberString = match.Groups[1].Value;
527-
int number = int.Parse(numberString);
528-
var disableSentry = Environment.GetEnvironmentVariable("DISABLE_SENTRY");
529-
var sentryDisabled = !string.IsNullOrEmpty(disableSentry) &&
530-
(disableSentry.ToLower() == "true" || disableSentry == "1");
531-
if (!sentryDisabled)
532-
{
533-
SentrySdk.ConfigureScope(scope =>
534-
{
535-
scope.SetTag("customerNo", number.ToString());
536-
Console.WriteLine("customerNo: " + number);
537-
scope.SetTag("osVersion", Environment.OSVersion.ToString());
538-
Console.WriteLine("osVersion: " + Environment.OSVersion);
539-
scope.SetTag("osArchitecture", RuntimeInformation.OSArchitecture.ToString());
540-
Console.WriteLine("osArchitecture: " + RuntimeInformation.OSArchitecture);
541-
scope.SetTag("osName", RuntimeInformation.OSDescription);
542-
Console.WriteLine("osName: " + RuntimeInformation.OSDescription);
543-
});
544-
}
509+
Log.LogEvent($"Creating ConnectionString file with the ConnectionString: {connectionString}");
510+
ConnectionStringManager.CreateWithConnectionString(filePath, connectionString);
545511
}
546512

547-
using var dbContext = contextFactory.CreateDbContext([_defaultConnectionString]);
548-
foreach (var plugin in EnabledPlugins)
513+
config.AddJsonFile("connection.json", optional: true, reloadOnChange: true);
514+
var mainSettings = ConnectionStringManager.Read(filePath);
515+
_defaultConnectionString = mainSettings?.ConnectionStrings?.DefaultConnection;
516+
config.AddEfConfiguration(_defaultConnectionString);
517+
EnabledPlugins = PluginHelper.GetPlugins(_defaultConnectionString);
518+
DisabledPlugins = PluginHelper.GetDisablePlugins(_defaultConnectionString);
519+
520+
var contextFactory = new BaseDbContextFactory();
521+
if (_defaultConnectionString != "...")
549522
{
550-
var pluginEntity = dbContext.EformPlugins
551-
.FirstOrDefault(x => x.PluginId == plugin.PluginId);
523+
string pattern = @"Database=(\d+)_Angular;";
524+
Match match = Regex.Match(_defaultConnectionString!, pattern);
552525

553-
if (pluginEntity != null && !string.IsNullOrEmpty(pluginEntity.ConnectionString))
526+
if (match.Success)
554527
{
555-
if (_defaultConnectionString.Contains("127.0.0.1"))
528+
string numberString = match.Groups[1].Value;
529+
int number = int.Parse(numberString);
530+
var disableSentry = Environment.GetEnvironmentVariable("DISABLE_SENTRY");
531+
var sentryDisabled = !string.IsNullOrEmpty(disableSentry) &&
532+
(disableSentry.ToLower() == "true" || disableSentry == "1");
533+
if (!sentryDisabled)
556534
{
557-
pluginEntity.ConnectionString = pluginEntity.ConnectionString.Replace(
558-
"mariadb-cluster-mariadb-galera",
559-
"127.0.0.1");
535+
SentrySdk.ConfigureScope(scope =>
536+
{
537+
scope.SetTag("customerNo", number.ToString());
538+
Console.WriteLine("customerNo: " + number);
539+
scope.SetTag("osVersion", Environment.OSVersion.ToString());
540+
Console.WriteLine("osVersion: " + Environment.OSVersion);
541+
scope.SetTag("osArchitecture", RuntimeInformation.OSArchitecture.ToString());
542+
Console.WriteLine("osArchitecture: " + RuntimeInformation.OSArchitecture);
543+
scope.SetTag("osName", RuntimeInformation.OSDescription);
544+
Console.WriteLine("osName: " + RuntimeInformation.OSDescription);
545+
});
560546
}
547+
}
561548

562-
plugin.AddPluginConfig(config, pluginEntity.ConnectionString);
549+
using var dbContext = contextFactory.CreateDbContext([_defaultConnectionString]);
550+
foreach (var plugin in EnabledPlugins)
551+
{
552+
var pluginEntity = dbContext.EformPlugins
553+
.FirstOrDefault(x => x.PluginId == plugin.PluginId);
554+
555+
if (pluginEntity != null && !string.IsNullOrEmpty(pluginEntity.ConnectionString))
556+
{
557+
if (_defaultConnectionString.Contains("127.0.0.1"))
558+
{
559+
pluginEntity.ConnectionString = pluginEntity.ConnectionString.Replace(
560+
"mariadb-cluster-mariadb-galera",
561+
"127.0.0.1");
562+
}
563+
564+
plugin.AddPluginConfig(config, pluginEntity.ConnectionString);
565+
}
563566
}
564567
}
565-
}
566568

567-
config.AddEnvironmentVariables();
569+
config.AddEnvironmentVariables();
570+
})
571+
.UseStartup<Startup>();
568572
})
569-
.UseStartup<Startup>()
570573
.Build();
571574
}
572575
}

eFormAPI/eFormAPI.Web/Resources/SharedResource.da.resx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,8 +694,6 @@
694694
</data>
695695
<data name="PasswordSuccessfullyUpdated" xml:space="preserve">
696696
<value>Adgangskode opdateret</value>
697-
</data><data name="UserNotFound" xml:space="preserve">
698-
<value>User with {0} not found</value>
699697
</data>
700698
<data name="ForgotPasswordEmailSubject" xml:space="preserve">
701699
<value>Nulstilling af adgangskode</value>

0 commit comments

Comments
 (0)