Developer 02 197db1e08b refactor: Entfernen des App Loggers und Implementierung des ILogger-Interfaces; Konfiguration der API für NLog
- App Logger entfernt und durch die Implementierung des `ILogger`-Interfaces ersetzt, um eine konsistente Logging-Architektur zu gewährleisten.
- API für die Nutzung von NLog konfiguriert, um eine leistungsstarke und flexible Logging-Lösung bereitzustellen.
- Konfigurationsdateien und Setup-Anpassungen für die Integration von NLog in die API vorgenommen.
2024-08-27 19:41:12 +02:00

38 lines
2.0 KiB
C#

using HRD.LDAPService;
using HRD.LDAPService.JWT;
using HRD.WebApi;
using Microsoft.Extensions.Configuration;
namespace XUnitWebApi.SharedConfig
{
public static class Shared_Test_Config
{
public static void Init_Webapi_Context()
{
if (WebApiConfig.Connectionstring != default) return; //all test are running simultain using the same WebApiConfig, therefore it must be initialised only one time
var app_path = Directory.GetCurrentDirectory();
var pos = app_path.IndexOf("XUnitDAL.Test");
if (pos >= 0) app_path = app_path.Remove(pos);
app_path += "StaffDBServer\\appsettings.json";
IConfiguration configuration = new ConfigurationBuilder().AddJsonFile(app_path, true, true).Build();
WebApiConfig.Init(configuration);
WebApiConfig.AssemblyName = "KabionlineServer_test";
WebApiConfig.AssemblyVersion = "xxx.xx";
//WebApiConfig.Connectionstring = Config_ConnectionString;
//WebApiConfig.NlogConnectionstring = Config_ConnectionString;
WebApiConfig.RaiseRepositoryExceptions = false;
//JWT#1
var jwtRoleList = new List<JwtRole>();
var ADGroupPrefix = WebApiConfig.IsLive ? "" : "__Test";
//jwtRoleList.Add(new JwtRole(JwtGlobals.ROLE_USER, "GG_WebApp" + ADGroupPrefix + "_Kabionline_User")); //(RO) nur eigene
//jwtRoleList.Add(new JwtRole(JwtGlobals.ROLE_MASTER, "GG_WebApp" + ADGroupPrefix + "_Kabionline_Master")); //RW ALLE Abteilungen
//jwtRoleList.Add(new JwtRole(JwtGlobals.ROLE_DEPARTMENTUSER, "GG_WebApp" + ADGroupPrefix + "_Kabionline_DepartmentUser")); //(RW) auch andere aus eigener Abteilung
//jwtRoleList.Add(new JwtRole(JwtGlobals.ROLE_DEPARTMENTMASTER, "GG_WebApp" + ADGroupPrefix + "_Kabionline_DepartmentMaster")); //(RW) auch andere aus eigener Abteilung
JwtTokenConfig.JwtRoleList = jwtRoleList;
}
}
}