Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Javier-RSP committed Oct 31, 2024
2 parents 2ba1051 + 37028b5 commit 0baeef3
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 5 deletions.
33 changes: 33 additions & 0 deletions Dockerfile-Kubernetes
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env

RUN sed -i "s|MinProtocol = TLSv1.2|MinProtocol = TLSv1|g" /etc/ssl/openssl.cnf && \
sed -i 's|CipherString = DEFAULT@SECLEVEL=2|CipherString = DEFAULT@SECLEVEL=1|g' /etc/ssl/openssl.cnf

RUN apt-get update && apt-get install -y --no-install-recommends curl

WORKDIR /app

COPY Gnoss.BackgroundTask.Replication/*.csproj ./

RUN dotnet restore

COPY . ./

RUN dotnet publish Gnoss.BackgroundTask.Replication/Gnoss.BackgroundTask.Replication.csproj -c Release -o out

FROM mcr.microsoft.com/dotnet/aspnet:6.0

RUN sed -i "s|MinProtocol = TLSv1.2|MinProtocol = TLSv1|g" /etc/ssl/openssl.cnf && \
sed -i 's|CipherString = DEFAULT@SECLEVEL=2|CipherString = DEFAULT@SECLEVEL=1|g' /etc/ssl/openssl.cnf

RUN apt-get update && apt-get install -y --no-install-recommends curl

WORKDIR /app
RUN useradd -r gnoss
RUN chown -R gnoss:gnoss /app
RUN chmod -R 777 /app
USER gnoss

COPY --from=build-env /app/out .

ENTRYPOINT ["dotnet", "Gnoss.BackgroundTask.Replication.dll"]
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="5.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />
<PackageReference Include="Npgsql" Version="6.0.9" />
<PackageReference Include="Npgsql" Version="6.0.11" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.8" />
<PackageReference Include="Oracle.EntityFrameworkCore" Version="6.21.90" />
</ItemGroup>
Expand Down
32 changes: 28 additions & 4 deletions Gnoss.BackgroundTask.Replication/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,22 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
.ConfigureServices((hostContext, services) =>
{
IConfiguration configuration = hostContext.Configuration;
services.AddScoped(typeof(UtilTelemetry));
ILoggerFactory loggerFactory =
LoggerFactory.Create(builder =>
{
builder.AddConfiguration(configuration.GetSection("Logging"));
builder.AddSimpleConsole(options =>
{
options.IncludeScopes = true;
options.SingleLine = true;
options.TimestampFormat = "yyyy-MM-dd HH:mm:ss ";
options.UseUtcTimestamp = true;
});
});

services.AddSingleton(loggerFactory);
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
services.AddScoped(typeof(UtilTelemetry));
services.AddScoped(typeof(Usuario));
services.AddScoped(typeof(UtilPeticion));

Expand All @@ -59,13 +74,12 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
{
bdType = configuration.GetConnectionString("connectionType");
}
if (bdType.Equals("2"))
if (bdType.Equals("2") || bdType.Equals("1"))
{
services.AddScoped(typeof(DbContextOptions<EntityContext>));
services.AddScoped(typeof(DbContextOptions<EntityContextBASE>));
}
services.AddSingleton<ConfigService>();
services.AddSingleton<ILoggerFactory, LoggerFactory>();

string acid = "";
if (environmentVariables.Contains("acid"))
Expand Down Expand Up @@ -95,7 +109,17 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>

);
}
else if (bdType.Equals("2"))
else if (bdType.Equals("1"))
{
services.AddDbContext<EntityContext, EntityContextOracle>(options =>
options.UseOracle(acid)
);
services.AddDbContext<EntityContextBASE, EntityContextBASEOracle>(options =>
options.UseOracle(baseConnection)

);
}
else if (bdType.Equals("2"))
{
services.AddDbContext<EntityContext, EntityContextPostgres>(opt =>
{
Expand Down

0 comments on commit 0baeef3

Please sign in to comment.