Add MonIn Send Status
This commit is contained in:
parent
672b439864
commit
f36ad1ae5e
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -2,5 +2,6 @@
|
|||||||
"cSpell.enabled": false,
|
"cSpell.enabled": false,
|
||||||
"files.exclude": {
|
"files.exclude": {
|
||||||
"**/.git": false
|
"**/.git": false
|
||||||
}
|
},
|
||||||
|
"coverage-gutters.coverageBaseDir": "../.vscode/TestResults/*"
|
||||||
}
|
}
|
@ -29,6 +29,9 @@
|
|||||||
<PackageReference Include="jQuery" Version="3.6.0" />
|
<PackageReference Include="jQuery" Version="3.6.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Infineon.Monitoring.MonA" Version="2.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="6.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="6.0.1" />
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Infineon.Monitoring.MonA;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using OI.Metrology.Archive.Models;
|
using OI.Metrology.Archive.Models;
|
||||||
@ -17,11 +18,13 @@ public class ExportController : Controller
|
|||||||
private readonly ILogger _Logger;
|
private readonly ILogger _Logger;
|
||||||
private readonly bool _IsTestDatabase;
|
private readonly bool _IsTestDatabase;
|
||||||
private readonly IMetrologyRepo _Repo;
|
private readonly IMetrologyRepo _Repo;
|
||||||
|
private readonly AppSettings _AppSettings;
|
||||||
|
|
||||||
public ExportController(AppSettings appSettings, ILogger<ExportController> logger, IMetrologyRepo repo)
|
public ExportController(AppSettings appSettings, ILogger<ExportController> logger, IMetrologyRepo repo)
|
||||||
{
|
{
|
||||||
_Repo = repo;
|
_Repo = repo;
|
||||||
_Logger = logger;
|
_Logger = logger;
|
||||||
|
_AppSettings = appSettings;
|
||||||
_IsTestDatabase = appSettings.ConnectionString.Contains("test", StringComparison.InvariantCultureIgnoreCase);
|
_IsTestDatabase = appSettings.ConnectionString.Contains("test", StringComparison.InvariantCultureIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,6 +44,8 @@ public class ExportController : Controller
|
|||||||
StartTime = DateTime.Now.AddMonths(-1),
|
StartTime = DateTime.Now.AddMonths(-1),
|
||||||
EndTime = DateTime.Now
|
EndTime = DateTime.Now
|
||||||
};
|
};
|
||||||
|
MonIn monIn = MonIn.GetInstance();
|
||||||
|
_ = monIn.SendStatus(_AppSettings.MonASite, _AppSettings.MonAResource, "Heartbeat", State.Up);
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,49 +6,38 @@ namespace OI.Metrology.Archive.Models;
|
|||||||
public class AppSettings
|
public class AppSettings
|
||||||
{
|
{
|
||||||
|
|
||||||
protected string _ApiLoggingContentTypes;
|
public string ApiLoggingContentTypes { init; get; }
|
||||||
protected string _ApiLoggingPathPrefixes;
|
public string ApiLoggingPathPrefixes { init; get; }
|
||||||
protected string _ApiLogPath;
|
public string ApiLogPath { init; get; }
|
||||||
protected string _AttachmentPath;
|
public string AttachmentPath { init; get; }
|
||||||
protected string _BuildNumber;
|
public string BuildNumber { init; get; }
|
||||||
protected string _Company;
|
public string Company { init; get; }
|
||||||
protected string _ConnectionString;
|
public string ConnectionString { init; get; }
|
||||||
protected string _GitCommitSeven;
|
public string GitCommitSeven { init; get; }
|
||||||
protected string _InboundApiAllowedIPList;
|
public string InboundApiAllowedIPList { init; get; }
|
||||||
protected string _MonARessource;
|
public string MonAResource { init; get; }
|
||||||
protected string _OIExportPath;
|
public string MonASite { init; get; }
|
||||||
protected string _URLs;
|
public string OIExportPath { init; get; }
|
||||||
protected string _WorkingDirectoryName;
|
public string URLs { init; get; }
|
||||||
public string ApiLoggingContentTypes => _ApiLoggingContentTypes;
|
public string WorkingDirectoryName { init; get; }
|
||||||
public string ApiLoggingPathPrefixes => _ApiLoggingPathPrefixes;
|
|
||||||
public string ApiLogPath => _ApiLogPath;
|
|
||||||
public string AttachmentPath => _AttachmentPath;
|
|
||||||
public string BuildNumber => _BuildNumber;
|
|
||||||
public string Company => _Company;
|
|
||||||
public string ConnectionString => _ConnectionString;
|
|
||||||
public string GitCommitSeven => _GitCommitSeven;
|
|
||||||
public string InboundApiAllowedIPList => _InboundApiAllowedIPList;
|
|
||||||
public string MonARessource => _MonARessource;
|
|
||||||
public string OIExportPath => _OIExportPath;
|
|
||||||
public string URLs => _URLs;
|
|
||||||
public string WorkingDirectoryName => _WorkingDirectoryName;
|
|
||||||
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public AppSettings(string apiLoggingContentTypes, string apiLoggingPathPrefixes, string apiLogPath, string attachmentPath, string buildNumber, string company, string connectionString, string gitCommitSeven, string inboundApiAllowedIPList, string monARessource, string oiExportPath, string urls, string workingDirectoryName)
|
public AppSettings(string apiLoggingContentTypes, string apiLoggingPathPrefixes, string apiLogPath, string attachmentPath, string buildNumber, string company, string connectionString, string gitCommitSeven, string inboundApiAllowedIPList, string monAResource, string monASite, string oiExportPath, string urls, string workingDirectoryName)
|
||||||
{
|
{
|
||||||
_ApiLoggingContentTypes = apiLoggingContentTypes;
|
ApiLoggingContentTypes = apiLoggingContentTypes;
|
||||||
_ApiLoggingPathPrefixes = apiLoggingPathPrefixes;
|
ApiLoggingPathPrefixes = apiLoggingPathPrefixes;
|
||||||
_ApiLogPath = apiLogPath;
|
ApiLogPath = apiLogPath;
|
||||||
_AttachmentPath = attachmentPath;
|
AttachmentPath = attachmentPath;
|
||||||
_BuildNumber = buildNumber;
|
BuildNumber = buildNumber;
|
||||||
_Company = company;
|
Company = company;
|
||||||
_ConnectionString = connectionString;
|
ConnectionString = connectionString;
|
||||||
_GitCommitSeven = gitCommitSeven;
|
GitCommitSeven = gitCommitSeven;
|
||||||
_InboundApiAllowedIPList = inboundApiAllowedIPList;
|
InboundApiAllowedIPList = inboundApiAllowedIPList;
|
||||||
_MonARessource = monARessource;
|
MonAResource = monAResource;
|
||||||
_OIExportPath = oiExportPath;
|
MonASite = monASite;
|
||||||
_URLs = urls;
|
OIExportPath = oiExportPath;
|
||||||
_WorkingDirectoryName = workingDirectoryName;
|
URLs = urls;
|
||||||
|
WorkingDirectoryName = workingDirectoryName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
@ -6,6 +7,8 @@ namespace OI.Metrology.Archive.Models.Binder;
|
|||||||
public class AppSettings
|
public class AppSettings
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
[Display(Name = "Api Logging Content Types"), Required] public string ApiLoggingContentTypes { get; set; }
|
[Display(Name = "Api Logging Content Types"), Required] public string ApiLoggingContentTypes { get; set; }
|
||||||
[Display(Name = "Api Logging Path Prefixes"), Required] public string ApiLoggingPathPrefixes { get; set; }
|
[Display(Name = "Api Logging Path Prefixes"), Required] public string ApiLoggingPathPrefixes { get; set; }
|
||||||
[Display(Name = "Api Log Path"), Required] public string ApiLogPath { get; set; }
|
[Display(Name = "Api Log Path"), Required] public string ApiLogPath { get; set; }
|
||||||
@ -15,27 +18,13 @@ public class AppSettings
|
|||||||
[Display(Name = "Connection String"), Required] public string ConnectionString { get; set; }
|
[Display(Name = "Connection String"), Required] public string ConnectionString { get; set; }
|
||||||
[Display(Name = "Git Commit Seven"), Required] public string GitCommitSeven { get; set; }
|
[Display(Name = "Git Commit Seven"), Required] public string GitCommitSeven { get; set; }
|
||||||
[Display(Name = "Inbound Api Allowed IP List"), Required] public string InboundApiAllowedIPList { get; set; }
|
[Display(Name = "Inbound Api Allowed IP List"), Required] public string InboundApiAllowedIPList { get; set; }
|
||||||
[Display(Name = "MonA Ressource"), Required] public string MonARessource { get; set; }
|
[Display(Name = "MonA Resource"), Required] public string MonAResource { get; set; }
|
||||||
|
[Display(Name = "MonA Site"), Required] public string MonASite { get; set; }
|
||||||
[Display(Name = "OI Export Path"), Required] public string OIExportPath { get; set; }
|
[Display(Name = "OI Export Path"), Required] public string OIExportPath { get; set; }
|
||||||
[Display(Name = "URLs"), Required] public string URLs { get; set; }
|
[Display(Name = "URLs"), Required] public string URLs { get; set; }
|
||||||
[Display(Name = "Working Directory Name"), Required] public string WorkingDirectoryName { get; set; }
|
[Display(Name = "Working Directory Name"), Required] public string WorkingDirectoryName { get; set; }
|
||||||
|
|
||||||
public AppSettings()
|
#nullable restore
|
||||||
{
|
|
||||||
ApiLoggingContentTypes = string.Empty;
|
|
||||||
ApiLoggingPathPrefixes = string.Empty;
|
|
||||||
ApiLogPath = string.Empty;
|
|
||||||
AttachmentPath = string.Empty;
|
|
||||||
BuildNumber = string.Empty;
|
|
||||||
Company = string.Empty;
|
|
||||||
ConnectionString = string.Empty;
|
|
||||||
GitCommitSeven = string.Empty;
|
|
||||||
InboundApiAllowedIPList = string.Empty;
|
|
||||||
MonARessource = string.Empty;
|
|
||||||
OIExportPath = string.Empty;
|
|
||||||
URLs = string.Empty;
|
|
||||||
WorkingDirectoryName = string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
@ -43,4 +32,33 @@ public class AppSettings
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Models.AppSettings Get(AppSettings appSettings)
|
||||||
|
{
|
||||||
|
Models.AppSettings result;
|
||||||
|
result = new(
|
||||||
|
appSettings.ApiLoggingContentTypes,
|
||||||
|
appSettings.ApiLoggingPathPrefixes,
|
||||||
|
appSettings.ApiLogPath,
|
||||||
|
appSettings.AttachmentPath,
|
||||||
|
appSettings.BuildNumber,
|
||||||
|
appSettings.Company,
|
||||||
|
appSettings.ConnectionString,
|
||||||
|
appSettings.GitCommitSeven,
|
||||||
|
appSettings.InboundApiAllowedIPList,
|
||||||
|
appSettings.MonAResource,
|
||||||
|
appSettings.MonASite,
|
||||||
|
appSettings.OIExportPath,
|
||||||
|
appSettings.URLs,
|
||||||
|
appSettings.WorkingDirectoryName);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
||||||
|
{
|
||||||
|
Models.AppSettings result;
|
||||||
|
AppSettings appSettings = configurationRoot.Get<AppSettings>();
|
||||||
|
result = Get(appSettings);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,44 +0,0 @@
|
|||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace OI.Metrology.Archive.Models.Stateless;
|
|
||||||
|
|
||||||
public abstract class AppSettings
|
|
||||||
{
|
|
||||||
|
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
|
||||||
{
|
|
||||||
Models.AppSettings? result;
|
|
||||||
Binder.AppSettings appSettings = configurationRoot.Get<Binder.AppSettings>();
|
|
||||||
string json = JsonSerializer.Serialize(appSettings, new JsonSerializerOptions() { WriteIndented = true });
|
|
||||||
result = JsonSerializer.Deserialize<Models.AppSettings>(json);
|
|
||||||
if (result is null)
|
|
||||||
throw new Exception(json);
|
|
||||||
if (string.IsNullOrEmpty(result.Company))
|
|
||||||
throw new Exception(json);
|
|
||||||
string jsonThis = result.ToString();
|
|
||||||
if (jsonThis != json)
|
|
||||||
{
|
|
||||||
int? check = null;
|
|
||||||
int min = new int[] { json.Length, jsonThis.Length }.Min();
|
|
||||||
for (int i = 0; i < min; i++)
|
|
||||||
{
|
|
||||||
if (json[i] == jsonThis[i])
|
|
||||||
continue;
|
|
||||||
check = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (check is null)
|
|
||||||
throw new Exception();
|
|
||||||
string a = json[..check.Value].Split(',')[^1];
|
|
||||||
string b = json[check.Value..].Split(',')[0];
|
|
||||||
throw new Exception($"{a}{b}");
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -50,7 +50,7 @@ public class Program
|
|||||||
(string assemblyName, WebApplicationOptions _) = Get(args);
|
(string assemblyName, WebApplicationOptions _) = Get(args);
|
||||||
WebApplicationBuilder webApplicationBuilder = WebApplication.CreateBuilder();
|
WebApplicationBuilder webApplicationBuilder = WebApplication.CreateBuilder();
|
||||||
_ = webApplicationBuilder.Configuration.AddUserSecrets<Program>();
|
_ = webApplicationBuilder.Configuration.AddUserSecrets<Program>();
|
||||||
AppSettings appSettings = Models.Stateless.AppSettings.Get(webApplicationBuilder.Configuration);
|
AppSettings appSettings = Models.Binder.AppSettings.Get(webApplicationBuilder.Configuration);
|
||||||
if (string.IsNullOrEmpty(appSettings.WorkingDirectoryName))
|
if (string.IsNullOrEmpty(appSettings.WorkingDirectoryName))
|
||||||
throw new Exception("Working directory name must have a value!");
|
throw new Exception("Working directory name must have a value!");
|
||||||
string workingDirectory = IWorkingDirectory.GetWorkingDirectory(assemblyName, appSettings.WorkingDirectoryName);
|
string workingDirectory = IWorkingDirectory.GetWorkingDirectory(assemblyName, appSettings.WorkingDirectoryName);
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"InboundApiAllowedIPList": "",
|
"InboundApiAllowedIPList": "",
|
||||||
|
"MonAResource": "OI_Metrology_Archive_IFX",
|
||||||
|
"MonASite": "sjc",
|
||||||
"OIExportPath": "\\\\openinsight-db-srv.na.infineon.com\\apps\\Metrology\\Data",
|
"OIExportPath": "\\\\openinsight-db-srv.na.infineon.com\\apps\\Metrology\\Data",
|
||||||
"Serilog": {
|
"Serilog": {
|
||||||
"Using": [
|
"Using": [
|
||||||
|
@ -16,7 +16,9 @@
|
|||||||
"Microsoft.Hosting.Lifetime": "Information"
|
"Microsoft.Hosting.Lifetime": "Information"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"MonAResource": "OI_Metrology_Archive_EC",
|
||||||
"InboundApiAllowedIPList": "",
|
"InboundApiAllowedIPList": "",
|
||||||
|
"MonASite": "sjc",
|
||||||
"OIExportPath": "\\\\openinsight-db-srv.na.infineon.com\\apps\\Metrology\\Data",
|
"OIExportPath": "\\\\openinsight-db-srv.na.infineon.com\\apps\\Metrology\\Data",
|
||||||
"Serilog": {
|
"Serilog": {
|
||||||
"Using": [
|
"Using": [
|
||||||
|
@ -26,4 +26,10 @@ Ouellette Jonathan (IFAM IT FI MES) created #315807, 7/25/2022
|
|||||||
|
|
||||||
## TFS / Azure DevOps - Pipelines
|
## TFS / Azure DevOps - Pipelines
|
||||||
* https://tfs.intra.infineon.com/tfs/manufacturingit/Mesa_FI/_build?definitionId=5439&_a=summary
|
* https://tfs.intra.infineon.com/tfs/manufacturingit/Mesa_FI/_build?definitionId=5439&_a=summary
|
||||||
* https://tfs.intra.infineon.com/tfs/manufacturingit/Mesa_FI/_release?_a=releases&view=mine&definitionId=1
|
* https://tfs.intra.infineon.com/tfs/manufacturingit/Mesa_FI/_release?_a=releases&view=mine&definitionId=1
|
||||||
|
|
||||||
|
4c07c49f3b9daa69fecd9d5be64e047d0ad6be1d
|
||||||
|
343ff2d792149c9eef1216f44dbdb73935cf6041
|
||||||
|
|
||||||
|
https://oi-metrology-viewer-prod.mes.infineon.com/
|
||||||
|
https://oi-metrology-viewer-archive.mes.infineon.com/
|
@ -6,49 +6,38 @@ namespace OI.Metrology.Tests.Models;
|
|||||||
public class AppSettings
|
public class AppSettings
|
||||||
{
|
{
|
||||||
|
|
||||||
protected string _ApiLoggingContentTypes;
|
public string ApiLoggingContentTypes { init; get; }
|
||||||
protected string _ApiLoggingPathPrefixes;
|
public string ApiLoggingPathPrefixes { init; get; }
|
||||||
protected string _ApiLogPath;
|
public string ApiLogPath { init; get; }
|
||||||
protected string _AttachmentPath;
|
public string AttachmentPath { init; get; }
|
||||||
protected string _BuildNumber;
|
public string BuildNumber { init; get; }
|
||||||
protected string _Company;
|
public string Company { init; get; }
|
||||||
protected string _ConnectionString;
|
public string ConnectionString { init; get; }
|
||||||
protected string _GitCommitSeven;
|
public string GitCommitSeven { init; get; }
|
||||||
protected string _InboundApiAllowedIPList;
|
public string InboundApiAllowedIPList { init; get; }
|
||||||
protected string _MonARessource;
|
public string MonAResource { init; get; }
|
||||||
protected string _OIExportPath;
|
public string MonASite { init; get; }
|
||||||
protected string _URLs;
|
public string OIExportPath { init; get; }
|
||||||
protected string _WorkingDirectoryName;
|
public string URLs { init; get; }
|
||||||
public string ApiLoggingContentTypes => _ApiLoggingContentTypes;
|
public string WorkingDirectoryName { init; get; }
|
||||||
public string ApiLoggingPathPrefixes => _ApiLoggingPathPrefixes;
|
|
||||||
public string ApiLogPath => _ApiLogPath;
|
|
||||||
public string AttachmentPath => _AttachmentPath;
|
|
||||||
public string BuildNumber => _BuildNumber;
|
|
||||||
public string Company => _Company;
|
|
||||||
public string ConnectionString => _ConnectionString;
|
|
||||||
public string GitCommitSeven => _GitCommitSeven;
|
|
||||||
public string InboundApiAllowedIPList => _InboundApiAllowedIPList;
|
|
||||||
public string MonARessource => _MonARessource;
|
|
||||||
public string OIExportPath => _OIExportPath;
|
|
||||||
public string URLs => _URLs;
|
|
||||||
public string WorkingDirectoryName => _WorkingDirectoryName;
|
|
||||||
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public AppSettings(string apiLoggingContentTypes, string apiLoggingPathPrefixes, string apiLogPath, string attachmentPath, string buildNumber, string company, string connectionString, string gitCommitSeven, string inboundApiAllowedIPList, string monARessource, string oiExportPath, string urls, string workingDirectoryName)
|
public AppSettings(string apiLoggingContentTypes, string apiLoggingPathPrefixes, string apiLogPath, string attachmentPath, string buildNumber, string company, string connectionString, string gitCommitSeven, string inboundApiAllowedIPList, string monAResource, string monASite, string oiExportPath, string urls, string workingDirectoryName)
|
||||||
{
|
{
|
||||||
_ApiLoggingContentTypes = apiLoggingContentTypes;
|
ApiLoggingContentTypes = apiLoggingContentTypes;
|
||||||
_ApiLoggingPathPrefixes = apiLoggingPathPrefixes;
|
ApiLoggingPathPrefixes = apiLoggingPathPrefixes;
|
||||||
_ApiLogPath = apiLogPath;
|
ApiLogPath = apiLogPath;
|
||||||
_AttachmentPath = attachmentPath;
|
AttachmentPath = attachmentPath;
|
||||||
_BuildNumber = buildNumber;
|
BuildNumber = buildNumber;
|
||||||
_Company = company;
|
Company = company;
|
||||||
_ConnectionString = connectionString;
|
ConnectionString = connectionString;
|
||||||
_GitCommitSeven = gitCommitSeven;
|
GitCommitSeven = gitCommitSeven;
|
||||||
_InboundApiAllowedIPList = inboundApiAllowedIPList;
|
InboundApiAllowedIPList = inboundApiAllowedIPList;
|
||||||
_MonARessource = monARessource;
|
MonAResource = monAResource;
|
||||||
_OIExportPath = oiExportPath;
|
MonASite = monASite;
|
||||||
_URLs = urls;
|
OIExportPath = oiExportPath;
|
||||||
_WorkingDirectoryName = workingDirectoryName;
|
URLs = urls;
|
||||||
|
WorkingDirectoryName = workingDirectoryName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
@ -6,6 +7,8 @@ namespace OI.Metrology.Tests.Models.Binder;
|
|||||||
public class AppSettings
|
public class AppSettings
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
[Display(Name = "Api Logging Content Types"), Required] public string ApiLoggingContentTypes { get; set; }
|
[Display(Name = "Api Logging Content Types"), Required] public string ApiLoggingContentTypes { get; set; }
|
||||||
[Display(Name = "Api Logging Path Prefixes"), Required] public string ApiLoggingPathPrefixes { get; set; }
|
[Display(Name = "Api Logging Path Prefixes"), Required] public string ApiLoggingPathPrefixes { get; set; }
|
||||||
[Display(Name = "Api Log Path"), Required] public string ApiLogPath { get; set; }
|
[Display(Name = "Api Log Path"), Required] public string ApiLogPath { get; set; }
|
||||||
@ -15,27 +18,13 @@ public class AppSettings
|
|||||||
[Display(Name = "Connection String"), Required] public string ConnectionString { get; set; }
|
[Display(Name = "Connection String"), Required] public string ConnectionString { get; set; }
|
||||||
[Display(Name = "Git Commit Seven"), Required] public string GitCommitSeven { get; set; }
|
[Display(Name = "Git Commit Seven"), Required] public string GitCommitSeven { get; set; }
|
||||||
[Display(Name = "Inbound Api Allowed IP List"), Required] public string InboundApiAllowedIPList { get; set; }
|
[Display(Name = "Inbound Api Allowed IP List"), Required] public string InboundApiAllowedIPList { get; set; }
|
||||||
[Display(Name = "MonA Ressource"), Required] public string MonARessource { get; set; }
|
[Display(Name = "MonA Resource"), Required] public string MonAResource { get; set; }
|
||||||
|
[Display(Name = "MonA Site"), Required] public string MonASite { get; set; }
|
||||||
[Display(Name = "OI Export Path"), Required] public string OIExportPath { get; set; }
|
[Display(Name = "OI Export Path"), Required] public string OIExportPath { get; set; }
|
||||||
[Display(Name = "URLs"), Required] public string URLs { get; set; }
|
[Display(Name = "URLs"), Required] public string URLs { get; set; }
|
||||||
[Display(Name = "Working Directory Name"), Required] public string WorkingDirectoryName { get; set; }
|
[Display(Name = "Working Directory Name"), Required] public string WorkingDirectoryName { get; set; }
|
||||||
|
|
||||||
public AppSettings()
|
#nullable restore
|
||||||
{
|
|
||||||
ApiLoggingContentTypes = string.Empty;
|
|
||||||
ApiLoggingPathPrefixes = string.Empty;
|
|
||||||
ApiLogPath = string.Empty;
|
|
||||||
AttachmentPath = string.Empty;
|
|
||||||
BuildNumber = string.Empty;
|
|
||||||
Company = string.Empty;
|
|
||||||
ConnectionString = string.Empty;
|
|
||||||
GitCommitSeven = string.Empty;
|
|
||||||
InboundApiAllowedIPList = string.Empty;
|
|
||||||
MonARessource = string.Empty;
|
|
||||||
OIExportPath = string.Empty;
|
|
||||||
URLs = string.Empty;
|
|
||||||
WorkingDirectoryName = string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
@ -43,4 +32,33 @@ public class AppSettings
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Models.AppSettings Get(AppSettings appSettings)
|
||||||
|
{
|
||||||
|
Models.AppSettings result;
|
||||||
|
result = new(
|
||||||
|
appSettings.ApiLoggingContentTypes,
|
||||||
|
appSettings.ApiLoggingPathPrefixes,
|
||||||
|
appSettings.ApiLogPath,
|
||||||
|
appSettings.AttachmentPath,
|
||||||
|
appSettings.BuildNumber,
|
||||||
|
appSettings.Company,
|
||||||
|
appSettings.ConnectionString,
|
||||||
|
appSettings.GitCommitSeven,
|
||||||
|
appSettings.InboundApiAllowedIPList,
|
||||||
|
appSettings.MonAResource,
|
||||||
|
appSettings.MonASite,
|
||||||
|
appSettings.OIExportPath,
|
||||||
|
appSettings.URLs,
|
||||||
|
appSettings.WorkingDirectoryName);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
||||||
|
{
|
||||||
|
Models.AppSettings result;
|
||||||
|
AppSettings appSettings = configurationRoot.Get<AppSettings>();
|
||||||
|
result = Get(appSettings);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,44 +0,0 @@
|
|||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace OI.Metrology.Tests.Models.Stateless;
|
|
||||||
|
|
||||||
public abstract class AppSettings
|
|
||||||
{
|
|
||||||
|
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
|
||||||
{
|
|
||||||
Models.AppSettings? result;
|
|
||||||
Binder.AppSettings appSettings = configurationRoot.Get<Binder.AppSettings>();
|
|
||||||
string json = JsonSerializer.Serialize(appSettings, new JsonSerializerOptions() { WriteIndented = true });
|
|
||||||
result = JsonSerializer.Deserialize<Models.AppSettings>(json);
|
|
||||||
if (result is null)
|
|
||||||
throw new Exception(json);
|
|
||||||
if (string.IsNullOrEmpty(result.Company))
|
|
||||||
throw new Exception(json);
|
|
||||||
string jsonThis = result.ToString();
|
|
||||||
if (jsonThis != json)
|
|
||||||
{
|
|
||||||
int? check = null;
|
|
||||||
int min = new int[] { json.Length, jsonThis.Length }.Min();
|
|
||||||
for (int i = 0; i < min; i++)
|
|
||||||
{
|
|
||||||
if (json[i] == jsonThis[i])
|
|
||||||
continue;
|
|
||||||
check = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (check is null)
|
|
||||||
throw new Exception();
|
|
||||||
string a = json[..check.Value].Split(',')[^1];
|
|
||||||
string b = json[check.Value..].Split(',')[0];
|
|
||||||
throw new Exception($"{a}{b}");
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -7,6 +7,11 @@
|
|||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup>
|
||||||
|
<VSTestLogger>trx</VSTestLogger>
|
||||||
|
<VSTestCollect>XPlat Code Coverage</VSTestCollect>
|
||||||
|
<VSTestResultsDirectory>../.vscode/TestResults</VSTestResultsDirectory>
|
||||||
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
|
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
|
||||||
<IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX>
|
<IsOSX Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</IsOSX>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using OI.Metrology.Shared.Models;
|
||||||
|
using OI.Metrology.Tests.Models;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using OI.Metrology.Tests.Models;
|
|
||||||
using OI.Metrology.Shared.Models;
|
|
||||||
|
|
||||||
namespace View_by_Distance.Tests;
|
namespace View_by_Distance.Tests;
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ public class UnitTestArchive
|
|||||||
.AddEnvironmentVariables()
|
.AddEnvironmentVariables()
|
||||||
.AddJsonFile("appsettings.Development.json");
|
.AddJsonFile("appsettings.Development.json");
|
||||||
configurationRoot = configurationBuilder.Build();
|
configurationRoot = configurationBuilder.Build();
|
||||||
appSettings = OI.Metrology.Tests.Models.Stateless.AppSettings.Get(configurationRoot);
|
appSettings = OI.Metrology.Tests.Models.Binder.AppSettings.Get(configurationRoot);
|
||||||
workingDirectory = IWorkingDirectory.GetWorkingDirectory(assembly.GetName().Name, appSettings.WorkingDirectoryName);
|
workingDirectory = IWorkingDirectory.GetWorkingDirectory(assembly.GetName().Name, appSettings.WorkingDirectoryName);
|
||||||
Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory);
|
Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory);
|
||||||
_ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, configurationRoot);
|
_ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, configurationRoot);
|
||||||
@ -56,7 +56,7 @@ public class UnitTestArchive
|
|||||||
Assert.IsFalse(_AppSettings is null);
|
Assert.IsFalse(_AppSettings is null);
|
||||||
Assert.IsFalse(_WorkingDirectory is null);
|
Assert.IsFalse(_WorkingDirectory is null);
|
||||||
Assert.IsFalse(_ConfigurationRoot is null);
|
Assert.IsFalse(_ConfigurationRoot is null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,8 +1,8 @@
|
|||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using OI.Metrology.Shared.Models;
|
||||||
|
using OI.Metrology.Tests.Models;
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using OI.Metrology.Tests.Models;
|
|
||||||
using OI.Metrology.Shared.Models;
|
|
||||||
|
|
||||||
namespace View_by_Distance.Tests;
|
namespace View_by_Distance.Tests;
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ public class UnitTestExample
|
|||||||
.AddEnvironmentVariables()
|
.AddEnvironmentVariables()
|
||||||
.AddJsonFile("appsettings.Development.json");
|
.AddJsonFile("appsettings.Development.json");
|
||||||
configurationRoot = configurationBuilder.Build();
|
configurationRoot = configurationBuilder.Build();
|
||||||
appSettings = OI.Metrology.Tests.Models.Stateless.AppSettings.Get(configurationRoot);
|
appSettings = OI.Metrology.Tests.Models.Binder.AppSettings.Get(configurationRoot);
|
||||||
workingDirectory = IWorkingDirectory.GetWorkingDirectory(assembly.GetName().Name, appSettings.WorkingDirectoryName);
|
workingDirectory = IWorkingDirectory.GetWorkingDirectory(assembly.GetName().Name, appSettings.WorkingDirectoryName);
|
||||||
Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory);
|
Environment.SetEnvironmentVariable(nameof(workingDirectory), workingDirectory);
|
||||||
_ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, configurationRoot);
|
_ = ConfigurationLoggerConfigurationExtensions.Configuration(loggerConfiguration.ReadFrom, configurationRoot);
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"InboundApiAllowedIPList": "",
|
"InboundApiAllowedIPList": "",
|
||||||
|
"MonASite": "sjc",
|
||||||
"OIExportPath": "\\\\openinsight-db-srv.na.infineon.com\\apps\\Metrology\\Data",
|
"OIExportPath": "\\\\openinsight-db-srv.na.infineon.com\\apps\\Metrology\\Data",
|
||||||
"Serilog": {
|
"Serilog": {
|
||||||
"Using": [
|
"Using": [
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"InboundApiAllowedIPList": "",
|
"InboundApiAllowedIPList": "",
|
||||||
|
"MonASite": "sjc",
|
||||||
"OIExportPath": "\\\\openinsight-db-srv.na.infineon.com\\apps\\Metrology\\Data",
|
"OIExportPath": "\\\\openinsight-db-srv.na.infineon.com\\apps\\Metrology\\Data",
|
||||||
"Serilog": {
|
"Serilog": {
|
||||||
"Using": [
|
"Using": [
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Infineon.Monitoring.MonA;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using OI.Metrology.Shared.DataModels;
|
using OI.Metrology.Shared.DataModels;
|
||||||
@ -17,11 +18,13 @@ public class ExportController : Controller
|
|||||||
private readonly ILogger _Logger;
|
private readonly ILogger _Logger;
|
||||||
private readonly bool _IsTestDatabase;
|
private readonly bool _IsTestDatabase;
|
||||||
private readonly IMetrologyRepo _Repo;
|
private readonly IMetrologyRepo _Repo;
|
||||||
|
private readonly AppSettings _AppSettings;
|
||||||
|
|
||||||
public ExportController(AppSettings appSettings, ILogger<ExportController> logger, IMetrologyRepo repo)
|
public ExportController(AppSettings appSettings, ILogger<ExportController> logger, IMetrologyRepo repo)
|
||||||
{
|
{
|
||||||
_Repo = repo;
|
_Repo = repo;
|
||||||
_Logger = logger;
|
_Logger = logger;
|
||||||
|
_AppSettings = appSettings;
|
||||||
_IsTestDatabase = appSettings.ConnectionString.Contains("test", StringComparison.InvariantCultureIgnoreCase);
|
_IsTestDatabase = appSettings.ConnectionString.Contains("test", StringComparison.InvariantCultureIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,6 +43,8 @@ public class ExportController : Controller
|
|||||||
StartTime = DateTime.Now.AddMonths(-1),
|
StartTime = DateTime.Now.AddMonths(-1),
|
||||||
EndTime = DateTime.Now
|
EndTime = DateTime.Now
|
||||||
};
|
};
|
||||||
|
MonIn monIn = MonIn.GetInstance();
|
||||||
|
_ = monIn.SendStatus(_AppSettings.MonASite, _AppSettings.MonAResource, "Heartbeat", State.Up);
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,49 +6,38 @@ namespace OI.Metrology.Viewer.Models;
|
|||||||
public class AppSettings
|
public class AppSettings
|
||||||
{
|
{
|
||||||
|
|
||||||
protected string _ApiLoggingContentTypes;
|
public string ApiLoggingContentTypes { init; get; }
|
||||||
protected string _ApiLoggingPathPrefixes;
|
public string ApiLoggingPathPrefixes { init; get; }
|
||||||
protected string _ApiLogPath;
|
public string ApiLogPath { init; get; }
|
||||||
protected string _AttachmentPath;
|
public string AttachmentPath { init; get; }
|
||||||
protected string _BuildNumber;
|
public string BuildNumber { init; get; }
|
||||||
protected string _Company;
|
public string Company { init; get; }
|
||||||
protected string _ConnectionString;
|
public string ConnectionString { init; get; }
|
||||||
protected string _GitCommitSeven;
|
public string GitCommitSeven { init; get; }
|
||||||
protected string _InboundApiAllowedIPList;
|
public string InboundApiAllowedIPList { init; get; }
|
||||||
protected string _MonARessource;
|
public string MonAResource { init; get; }
|
||||||
protected string _OIExportPath;
|
public string MonASite { init; get; }
|
||||||
protected string _URLs;
|
public string OIExportPath { init; get; }
|
||||||
protected string _WorkingDirectoryName;
|
public string URLs { init; get; }
|
||||||
public string ApiLoggingContentTypes => _ApiLoggingContentTypes;
|
public string WorkingDirectoryName { init; get; }
|
||||||
public string ApiLoggingPathPrefixes => _ApiLoggingPathPrefixes;
|
|
||||||
public string ApiLogPath => _ApiLogPath;
|
|
||||||
public string AttachmentPath => _AttachmentPath;
|
|
||||||
public string BuildNumber => _BuildNumber;
|
|
||||||
public string Company => _Company;
|
|
||||||
public string ConnectionString => _ConnectionString;
|
|
||||||
public string GitCommitSeven => _GitCommitSeven;
|
|
||||||
public string InboundApiAllowedIPList => _InboundApiAllowedIPList;
|
|
||||||
public string MonARessource => _MonARessource;
|
|
||||||
public string OIExportPath => _OIExportPath;
|
|
||||||
public string URLs => _URLs;
|
|
||||||
public string WorkingDirectoryName => _WorkingDirectoryName;
|
|
||||||
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public AppSettings(string apiLoggingContentTypes, string apiLoggingPathPrefixes, string apiLogPath, string attachmentPath, string buildNumber, string company, string connectionString, string gitCommitSeven, string inboundApiAllowedIPList, string monARessource, string oiExportPath, string urls, string workingDirectoryName)
|
public AppSettings(string apiLoggingContentTypes, string apiLoggingPathPrefixes, string apiLogPath, string attachmentPath, string buildNumber, string company, string connectionString, string gitCommitSeven, string inboundApiAllowedIPList, string monAResource, string monASite, string oiExportPath, string urls, string workingDirectoryName)
|
||||||
{
|
{
|
||||||
_ApiLoggingContentTypes = apiLoggingContentTypes;
|
ApiLoggingContentTypes = apiLoggingContentTypes;
|
||||||
_ApiLoggingPathPrefixes = apiLoggingPathPrefixes;
|
ApiLoggingPathPrefixes = apiLoggingPathPrefixes;
|
||||||
_ApiLogPath = apiLogPath;
|
ApiLogPath = apiLogPath;
|
||||||
_AttachmentPath = attachmentPath;
|
AttachmentPath = attachmentPath;
|
||||||
_BuildNumber = buildNumber;
|
BuildNumber = buildNumber;
|
||||||
_Company = company;
|
Company = company;
|
||||||
_ConnectionString = connectionString;
|
ConnectionString = connectionString;
|
||||||
_GitCommitSeven = gitCommitSeven;
|
GitCommitSeven = gitCommitSeven;
|
||||||
_InboundApiAllowedIPList = inboundApiAllowedIPList;
|
InboundApiAllowedIPList = inboundApiAllowedIPList;
|
||||||
_MonARessource = monARessource;
|
MonAResource = monAResource;
|
||||||
_OIExportPath = oiExportPath;
|
MonASite = monASite;
|
||||||
_URLs = urls;
|
OIExportPath = oiExportPath;
|
||||||
_WorkingDirectoryName = workingDirectoryName;
|
URLs = urls;
|
||||||
|
WorkingDirectoryName = workingDirectoryName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
@ -6,6 +7,8 @@ namespace OI.Metrology.Viewer.Models.Binder;
|
|||||||
public class AppSettings
|
public class AppSettings
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
[Display(Name = "Api Logging Content Types"), Required] public string ApiLoggingContentTypes { get; set; }
|
[Display(Name = "Api Logging Content Types"), Required] public string ApiLoggingContentTypes { get; set; }
|
||||||
[Display(Name = "Api Logging Path Prefixes"), Required] public string ApiLoggingPathPrefixes { get; set; }
|
[Display(Name = "Api Logging Path Prefixes"), Required] public string ApiLoggingPathPrefixes { get; set; }
|
||||||
[Display(Name = "Api Log Path"), Required] public string ApiLogPath { get; set; }
|
[Display(Name = "Api Log Path"), Required] public string ApiLogPath { get; set; }
|
||||||
@ -15,27 +18,13 @@ public class AppSettings
|
|||||||
[Display(Name = "Connection String"), Required] public string ConnectionString { get; set; }
|
[Display(Name = "Connection String"), Required] public string ConnectionString { get; set; }
|
||||||
[Display(Name = "Git Commit Seven"), Required] public string GitCommitSeven { get; set; }
|
[Display(Name = "Git Commit Seven"), Required] public string GitCommitSeven { get; set; }
|
||||||
[Display(Name = "Inbound Api Allowed IP List"), Required] public string InboundApiAllowedIPList { get; set; }
|
[Display(Name = "Inbound Api Allowed IP List"), Required] public string InboundApiAllowedIPList { get; set; }
|
||||||
[Display(Name = "MonA Ressource"), Required] public string MonARessource { get; set; }
|
[Display(Name = "MonA Resource"), Required] public string MonAResource { get; set; }
|
||||||
|
[Display(Name = "MonA Site"), Required] public string MonASite { get; set; }
|
||||||
[Display(Name = "OI Export Path"), Required] public string OIExportPath { get; set; }
|
[Display(Name = "OI Export Path"), Required] public string OIExportPath { get; set; }
|
||||||
[Display(Name = "URLs"), Required] public string URLs { get; set; }
|
[Display(Name = "URLs"), Required] public string URLs { get; set; }
|
||||||
[Display(Name = "Working Directory Name"), Required] public string WorkingDirectoryName { get; set; }
|
[Display(Name = "Working Directory Name"), Required] public string WorkingDirectoryName { get; set; }
|
||||||
|
|
||||||
public AppSettings()
|
#nullable restore
|
||||||
{
|
|
||||||
ApiLoggingContentTypes = string.Empty;
|
|
||||||
ApiLoggingPathPrefixes = string.Empty;
|
|
||||||
ApiLogPath = string.Empty;
|
|
||||||
AttachmentPath = string.Empty;
|
|
||||||
BuildNumber = string.Empty;
|
|
||||||
Company = string.Empty;
|
|
||||||
ConnectionString = string.Empty;
|
|
||||||
GitCommitSeven = string.Empty;
|
|
||||||
InboundApiAllowedIPList = string.Empty;
|
|
||||||
MonARessource = string.Empty;
|
|
||||||
OIExportPath = string.Empty;
|
|
||||||
URLs = string.Empty;
|
|
||||||
WorkingDirectoryName = string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
@ -43,4 +32,33 @@ public class AppSettings
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Models.AppSettings Get(AppSettings appSettings)
|
||||||
|
{
|
||||||
|
Models.AppSettings result;
|
||||||
|
result = new(
|
||||||
|
appSettings.ApiLoggingContentTypes,
|
||||||
|
appSettings.ApiLoggingPathPrefixes,
|
||||||
|
appSettings.ApiLogPath,
|
||||||
|
appSettings.AttachmentPath,
|
||||||
|
appSettings.BuildNumber,
|
||||||
|
appSettings.Company,
|
||||||
|
appSettings.ConnectionString,
|
||||||
|
appSettings.GitCommitSeven,
|
||||||
|
appSettings.InboundApiAllowedIPList,
|
||||||
|
appSettings.MonAResource,
|
||||||
|
appSettings.MonASite,
|
||||||
|
appSettings.OIExportPath,
|
||||||
|
appSettings.URLs,
|
||||||
|
appSettings.WorkingDirectoryName);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
||||||
|
{
|
||||||
|
Models.AppSettings result;
|
||||||
|
AppSettings appSettings = configurationRoot.Get<AppSettings>();
|
||||||
|
result = Get(appSettings);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,44 +0,0 @@
|
|||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace OI.Metrology.Viewer.Models.Stateless;
|
|
||||||
|
|
||||||
public abstract class AppSettings
|
|
||||||
{
|
|
||||||
|
|
||||||
#nullable enable
|
|
||||||
|
|
||||||
public static Models.AppSettings Get(IConfigurationRoot configurationRoot)
|
|
||||||
{
|
|
||||||
Models.AppSettings? result;
|
|
||||||
Binder.AppSettings appSettings = configurationRoot.Get<Binder.AppSettings>();
|
|
||||||
string json = JsonSerializer.Serialize(appSettings, new JsonSerializerOptions() { WriteIndented = true });
|
|
||||||
result = JsonSerializer.Deserialize<Models.AppSettings>(json);
|
|
||||||
if (result is null)
|
|
||||||
throw new Exception(json);
|
|
||||||
if (string.IsNullOrEmpty(result.Company))
|
|
||||||
throw new Exception(json);
|
|
||||||
string jsonThis = result.ToString();
|
|
||||||
if (jsonThis != json)
|
|
||||||
{
|
|
||||||
int? check = null;
|
|
||||||
int min = new int[] { json.Length, jsonThis.Length }.Min();
|
|
||||||
for (int i = 0; i < min; i++)
|
|
||||||
{
|
|
||||||
if (json[i] == jsonThis[i])
|
|
||||||
continue;
|
|
||||||
check = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (check is null)
|
|
||||||
throw new Exception();
|
|
||||||
string a = json[..check.Value].Split(',')[^1];
|
|
||||||
string b = json[check.Value..].Split(',')[0];
|
|
||||||
throw new Exception($"{a}{b}");
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -50,7 +50,7 @@ public class Program
|
|||||||
(string assemblyName, WebApplicationOptions _) = Get(args);
|
(string assemblyName, WebApplicationOptions _) = Get(args);
|
||||||
WebApplicationBuilder webApplicationBuilder = WebApplication.CreateBuilder();
|
WebApplicationBuilder webApplicationBuilder = WebApplication.CreateBuilder();
|
||||||
_ = webApplicationBuilder.Configuration.AddUserSecrets<Program>();
|
_ = webApplicationBuilder.Configuration.AddUserSecrets<Program>();
|
||||||
AppSettings appSettings = Models.Stateless.AppSettings.Get(webApplicationBuilder.Configuration);
|
AppSettings appSettings = Models.Binder.AppSettings.Get(webApplicationBuilder.Configuration);
|
||||||
if (string.IsNullOrEmpty(appSettings.WorkingDirectoryName))
|
if (string.IsNullOrEmpty(appSettings.WorkingDirectoryName))
|
||||||
throw new Exception("Working directory name must have a value!");
|
throw new Exception("Working directory name must have a value!");
|
||||||
string workingDirectory = IWorkingDirectory.GetWorkingDirectory(assemblyName, appSettings.WorkingDirectoryName);
|
string workingDirectory = IWorkingDirectory.GetWorkingDirectory(assemblyName, appSettings.WorkingDirectoryName);
|
||||||
|
@ -35,6 +35,9 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Infineon.Monitoring.MonA" Version="2.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Serilog.AspNetCore" Version="5.0.0" />
|
<PackageReference Include="Serilog.AspNetCore" Version="5.0.0" />
|
||||||
<PackageReference Include="Serilog.AspNetCore.Ingestion" Version="1.0.0-dev-00021" />
|
<PackageReference Include="Serilog.AspNetCore.Ingestion" Version="1.0.0-dev-00021" />
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
<li>@Html.ActionLink("Run Information", "RunInfo", "Pages", new { area = "" }, null)</li>
|
<li>@Html.ActionLink("Run Information", "RunInfo", "Pages", new { area = "" }, null)</li>
|
||||||
<li>@Html.ActionLink("Run Headers", "RunHeaders", "Pages", new { area = "" }, null)</li>
|
<li>@Html.ActionLink("Run Headers", "RunHeaders", "Pages", new { area = "" }, null)</li>
|
||||||
<li>@Html.ActionLink("Export", "Index", "Export", new { area = "" }, null)</li>
|
<li>@Html.ActionLink("Export", "Index", "Export", new { area = "" }, null)</li>
|
||||||
<li><a href="http://oi-metrology-viewer-archive.mes.infineon.com/" target="_blank">Archive</a></li>
|
<li><a href="https://oi-metrology-viewer-archive.mes.infineon.com/" target="_blank">Archive</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<p class="navbar-text navbar-right">
|
<p class="navbar-text navbar-right">
|
||||||
@User.Identity.Name
|
@User.Identity.Name
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"InboundApiAllowedIPList": "",
|
"InboundApiAllowedIPList": "",
|
||||||
|
"MonAResource": "OI_Metrology_Viewer_IFX",
|
||||||
|
"MonASite": "sjc",
|
||||||
"OIExportPath": "\\\\openinsight-db-srv.na.infineon.com\\apps\\Metrology\\Data",
|
"OIExportPath": "\\\\openinsight-db-srv.na.infineon.com\\apps\\Metrology\\Data",
|
||||||
"Serilog": {
|
"Serilog": {
|
||||||
"Using": [
|
"Using": [
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"InboundApiAllowedIPList": "",
|
"InboundApiAllowedIPList": "",
|
||||||
|
"MonAResource": "OI_Metrology_Viewer_EC",
|
||||||
|
"MonASite": "sjc",
|
||||||
"OIExportPath": "\\\\openinsight-db-srv.na.infineon.com\\apps\\Metrology\\Data",
|
"OIExportPath": "\\\\openinsight-db-srv.na.infineon.com\\apps\\Metrology\\Data",
|
||||||
"Serilog": {
|
"Serilog": {
|
||||||
"Using": [
|
"Using": [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user