ZUGFeRDWebService: Fix config

This commit is contained in:
Jonathan Jenne 2023-02-28 13:21:55 +01:00
parent 1c428b7db6
commit 2f11b7082b
3 changed files with 8 additions and 7 deletions

View File

@ -6,13 +6,17 @@
public string LogPath { get; set; } public string LogPath { get; set; }
public string MSSQLConnectionString { get; set; } public string MSSQLConnectionString { get; set; }
public string MaxFileSizeInMegabytes { get; set; } public string MaxFileSizeInMegabytes { get; set; }
public ZugferdConfig Zugferd { get; set; }
public FirebirdConfig Firebird { get; set; }
}
public class ZugferdConfig
{
public bool AllowFacturX { get; set; } = false; public bool AllowFacturX { get; set; } = false;
public bool AllowXRechnung { get; set; } = false; public bool AllowXRechnung { get; set; } = false;
public bool AllowZugferd10 { get; set; } = true; public bool AllowZugferd10 { get; set; } = true;
public bool AllowZugferd2x { get; set; } = true; public bool AllowZugferd2x { get; set; } = true;
public FirebirdConfig Firebird { get; set; }
} }
public class FirebirdConfig public class FirebirdConfig

View File

@ -107,8 +107,8 @@ namespace ZUGFeRDRESTService.Controllers
if (!bool.TryParse(oZugferdConfig["Zugferd10"], out _AllowZugferd10)) if (!bool.TryParse(oZugferdConfig["Zugferd10"], out _AllowZugferd10))
{ {
_logger.Info("Configuration Zugferd10 was not set. Using default value [{0}]", false); _logger.Info("Configuration Zugferd10 was not set. Using default value [{0}]", true);
_AllowZugferd10 = false; _AllowZugferd10 = true;
} }
if (!int.TryParse(oAppConfig["MaxFileSizeInMegabytes"], out _MaxFileSizeInMegabytes)) if (!int.TryParse(oAppConfig["MaxFileSizeInMegabytes"], out _MaxFileSizeInMegabytes))

View File

@ -33,10 +33,7 @@ namespace ZUGFeRDRESTService
services.AddControllers().AddNewtonsoftJson(); services.AddControllers().AddNewtonsoftJson();
services.AddRazorPages(); services.AddRazorPages();
services.Configure<Config>(Configuration.GetSection("Config"));
// brauchen sie das überhaupt???!!!?!?!!
//services.Configure<Config>(Configuration.GetSection("Config"));
services.AddSingleton<ILogging>(sp => new Logging(oLogPath, oLogDebug)); services.AddSingleton<ILogging>(sp => new Logging(oLogPath, oLogDebug));
services.AddSingleton((Func<IServiceProvider, IDatabase>)(sp => { services.AddSingleton((Func<IServiceProvider, IDatabase>)(sp => {
var logging = sp.GetService<ILogging>(); var logging = sp.GetService<ILogging>();