Skip to content

Commit 8a701c6

Browse files
committed
Merge remote-tracking branch 'origin/develop'
2 parents c3f4522 + f541895 commit 8a701c6

3 files changed

Lines changed: 62 additions & 5 deletions

File tree

Dockerfile-Kubernetes

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
2+
3+
RUN sed -i "s|MinProtocol = TLSv1.2|MinProtocol = TLSv1|g" /etc/ssl/openssl.cnf && \
4+
sed -i 's|CipherString = DEFAULT@SECLEVEL=2|CipherString = DEFAULT@SECLEVEL=1|g' /etc/ssl/openssl.cnf
5+
6+
RUN apt-get update && apt-get install -y --no-install-recommends curl
7+
8+
WORKDIR /app
9+
10+
COPY Gnoss.BackgroundTask.SocialCacheRefresh/*.csproj ./
11+
12+
RUN dotnet restore
13+
14+
COPY . ./
15+
16+
RUN dotnet publish Gnoss.BackgroundTask.SocialCacheRefresh/Gnoss.BackgroundTask.SocialCacheRefresh.csproj -c Release -o out
17+
18+
FROM mcr.microsoft.com/dotnet/aspnet:6.0
19+
20+
RUN sed -i "s|MinProtocol = TLSv1.2|MinProtocol = TLSv1|g" /etc/ssl/openssl.cnf && \
21+
sed -i 's|CipherString = DEFAULT@SECLEVEL=2|CipherString = DEFAULT@SECLEVEL=1|g' /etc/ssl/openssl.cnf
22+
23+
RUN apt-get update && apt-get install -y --no-install-recommends curl
24+
25+
WORKDIR /app
26+
RUN useradd -r gnoss
27+
RUN chown -R gnoss:gnoss /app
28+
RUN chmod -R 777 /app
29+
USER gnoss
30+
31+
COPY --from=build-env /app/out .
32+
33+
ENTRYPOINT ["dotnet", "Gnoss.BackgroundTask.SocialCacheRefresh.dll"]

Gnoss.BackgroundTask.SocialCacheRefresh/Gnoss.BackgroundTask.SocialCacheRefresh.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" />
1010
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="5.0.1" />
1111
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />
12-
<PackageReference Include="Npgsql" Version="6.0.9" />
12+
<PackageReference Include="Npgsql" Version="6.0.11" />
1313
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.8" />
1414
<PackageReference Include="Oracle.EntityFrameworkCore" Version="6.21.90" />
1515
</ItemGroup>

Gnoss.BackgroundTask.SocialCacheRefresh/Program.cs

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,22 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
3838
.ConfigureServices((hostContext, services) =>
3939
{
4040
IConfiguration configuration = hostContext.Configuration;
41-
services.AddScoped(typeof(UtilTelemetry));
41+
ILoggerFactory loggerFactory =
42+
LoggerFactory.Create(builder =>
43+
{
44+
builder.AddConfiguration(configuration.GetSection("Logging"));
45+
builder.AddSimpleConsole(options =>
46+
{
47+
options.IncludeScopes = true;
48+
options.SingleLine = true;
49+
options.TimestampFormat = "yyyy-MM-dd HH:mm:ss ";
50+
options.UseUtcTimestamp = true;
51+
});
52+
});
53+
54+
services.AddSingleton(loggerFactory);
55+
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
56+
services.AddScoped(typeof(UtilTelemetry));
4257
services.AddScoped(typeof(Usuario));
4358
services.AddScoped(typeof(UtilPeticion));
4459

@@ -59,13 +74,12 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
5974
{
6075
bdType = configuration.GetConnectionString("connectionType");
6176
}
62-
if (bdType.Equals("2"))
77+
if (bdType.Equals("2") || bdType.Equals("1"))
6378
{
6479
services.AddScoped(typeof(DbContextOptions<EntityContext>));
6580
services.AddScoped(typeof(DbContextOptions<EntityContextBASE>));
6681
}
6782
services.AddSingleton<ConfigService>();
68-
services.AddSingleton<ILoggerFactory, LoggerFactory>();
6983

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

96110
);
97111
}
98-
else if (bdType.Equals("2"))
112+
else if (bdType.Equals("1"))
113+
{
114+
services.AddDbContext<EntityContext, EntityContextOracle>(options =>
115+
options.UseOracle(acid)
116+
);
117+
services.AddDbContext<EntityContextBASE, EntityContextBASEOracle>(options =>
118+
options.UseOracle(baseConnection)
119+
120+
);
121+
}
122+
else if (bdType.Equals("2"))
99123
{
100124
services.AddDbContext<EntityContext, EntityContextPostgres>(opt =>
101125
{

0 commit comments

Comments
 (0)