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 1bb0c9a + 8e764d1 commit 54326c7
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 25 deletions.
30 changes: 30 additions & 0 deletions Dockerfile-Kubernetes
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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

WORKDIR /app

COPY Gnoss.Web.OAuth/*.csproj ./

RUN dotnet restore

COPY . ./

RUN dotnet publish Gnoss.Web.OAuth/Gnoss.Web.OAuth.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

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.Web.OAuth.dll"]

2 changes: 1 addition & 1 deletion Gnoss.Web.OAuth/Gnoss.Web.OAuth.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.20" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.20" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.9" />
<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" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
Expand Down
64 changes: 40 additions & 24 deletions Gnoss.Web.OAuth/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Es.Riam.Gnoss.Util.General;
using Es.Riam.Gnoss.Util.Seguridad;
using Es.Riam.Gnoss.UtilServiciosWeb;
using Es.Riam.Gnoss.Web.OAuthAD;
using Es.Riam.OpenReplication;
using Es.Riam.Util;
using Microsoft.AspNetCore.Builder;
Expand Down Expand Up @@ -41,7 +42,21 @@ public Startup(IConfiguration configuration, Microsoft.AspNetCore.Hosting.IHosti
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
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);
services.AddControllers();
services.AddHttpContextAccessor();
services.AddScoped(typeof(UtilTelemetry));
services.AddScoped(typeof(Usuario));
Expand All @@ -66,13 +81,13 @@ public void ConfigureServices(IServiceCollection services)
{
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.AddScoped(typeof(DbContextOptions<EntityContextOauth>));
}
services.AddSingleton(typeof(ConfigService));
services.AddSingleton<ILoggerFactory, LoggerFactory>();
services.AddMvc();
Conexion.ServicioWeb = true;

Expand Down Expand Up @@ -118,7 +133,21 @@ public void ConfigureServices(IServiceCollection services)

);
}
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)

);
services.AddDbContext<EntityContextOauth, EntityContextOauthOracle>(options =>
options.UseOracle(oauthConnection)

);
}
else if (bdType.Equals("2"))
{
services.AddDbContext<EntityContext, EntityContextPostgres>(opt =>
{
Expand Down Expand Up @@ -160,24 +189,17 @@ public void ConfigureServices(IServiceCollection services)
LoggingService.InicializarLogstash(configLogStash);
}
var entity = sp.GetService<EntityContext>();
LoggingService.RUTA_DIRECTORIO_ERROR = Path.Combine(mEnvironment.ContentRootPath, "logs");
var servicesUtilVirtuosoAndReplication = sp.GetService<IServicesUtilVirtuosoAndReplication>();
var loggingService = sp.GetService<LoggingService>();
var redisCacheWrapper = sp.GetService<RedisCacheWrapper>();
LoggingService.RUTA_DIRECTORIO_ERROR = Path.Combine(mEnvironment.ContentRootPath, "logs");
EntityContextOauth.ProxyCreationEnabled = false;

//TODO Javier
//BaseAD.LeerConfiguracionConexion(gestorParametroAplicacion.ListaConfiguracionBBDD.Where(confBBDD=>confBBDD.TipoConexion.Equals((short)TipoConexion.SQLServer)).ToList());

//TODO Javier
//BaseAD.LeerConfiguracionConexion(gestorParametroAplicacion.ListaConfiguracionBBDD.Where(confBBDD => confBBDD.TipoConexion.Equals((short)TipoConexion.Redis)).ToList());

//TODO Javier
//BaseAD.LeerConfiguracionConexion(gestorParametroAplicacion.ListaConfiguracionBBDD.Where(confBBDD => confBBDD.TipoConexion.Equals((short)TipoConexion.Virtuoso)).ToList());


EstablecerDominioCache(entity);

CargarIdiomasPlataforma(configService);
UtilServicios.CargarIdiomasPlataforma(entity, loggingService, configService, servicesUtilVirtuosoAndReplication, redisCacheWrapper);

services.AddSwaggerGen(c =>
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo { Title = "Gnoss.Web.OAuth", Version = "v1" });
});
Expand Down Expand Up @@ -223,11 +245,5 @@ private void EstablecerDominioCache(EntityContext entity)

BaseCL.DominioEstatico = dominio;
}

private void CargarIdiomasPlataforma(ConfigService configService)
{

configService.ObtenerListaIdiomas().FirstOrDefault();
}
}
}

0 comments on commit 54326c7

Please sign in to comment.