Pull Request 33523 suggestions
Pull Request 33520 suggestions Injected AppSettings instead of using GetEnvironmentVariable at Services level When debugging only app.Services.GetRequiredService<IPCRBService>(); Get ready to use VSCode IDE Align .editorconfig files
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
using Infineon.Monitoring.MonA;
|
||||
using FabApprovalWorkerService.Models;
|
||||
|
||||
using Infineon.Monitoring.MonA;
|
||||
|
||||
namespace FabApprovalWorkerService.Services;
|
||||
|
||||
@ -13,13 +15,11 @@ public class MonInClient : IMonInClient {
|
||||
private readonly string _site;
|
||||
private readonly string _resource;
|
||||
|
||||
public MonInClient(ILogger<MonInClient> logger) {
|
||||
public MonInClient(ILogger<MonInClient> logger, AppSettings appSettings) {
|
||||
_logger = logger ??
|
||||
throw new ArgumentNullException("ILogger not injected");
|
||||
_site = Environment.GetEnvironmentVariable("MonInSite") ??
|
||||
throw new ArgumentNullException("MonInSite environment variable not found");
|
||||
_resource = Environment.GetEnvironmentVariable("FabApprovalWorkerServiceMonInResource") ??
|
||||
throw new ArgumentNullException("FabApprovalWorkerServiceMonInResource environment variable not found");
|
||||
_site = appSettings.MonInSite;
|
||||
_resource = appSettings.WorkerServiceMonInResource;
|
||||
}
|
||||
|
||||
public void PostMetric(string metricName, double metricValue) {
|
||||
@ -55,4 +55,4 @@ public class MonInClient : IMonInClient {
|
||||
ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user