Deprecated: Function get_magic_quotes_gpc() is deprecated in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 99

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 619

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1169

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176
8000 Addressing SonarCloud suggestions by akornich · Pull Request #603 · rollbar/Rollbar.NET · GitHub
Nothing Special   »   [go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
2182223
refactor: addressed SonarCloud detected code smells in App.Config module
akornich Oct 18, 2021
46f3c94
refactor: addressed SonarCloud detected code smells in AppSettings.Js…
akornich Oct 19, 2021
845146f
refactor: addressed SonarCloud detected code smells in Deploys module
akornich Oct 19, 2021
9c95aa0
refactor: addressed SonarCloud detected code smells in Net.AspNet.Web…
akornich Oct 19, 2021
e35e35a
refactor: addressed SonarCloud detected code smells in Net.AspNet module
akornich Oct 19, 2021
03854d3
refactor: addressed SonarCloud detected code smells in NetCore.AspNet…
akornich Oct 20, 2021
c79c26c
refactor: addressed SonarCloud detected code smells in NetPlatformExt…
akornich Oct 21, 2021
1085fd7 8000
refactor: addressed SonarCloud detected code smells in OfflinePersist…
akornich Oct 22, 2021
bc38358
refactor: addressed SonarCloud detected code smells in PlugIns.Log4ne…
akornich Oct 22, 2021
d75435e
refactor: added Sonar code analyzer package to all product projects
akornich Oct 22, 2021
e3baa38
refactor: [WIP] addressed SonarCloud detected code smells in Rollbar …
akornich Oct 27, 2021
39b6c8d
refactor: [WIP] addressed SonarCloud detected code smells in Rollbar …
akornich Oct 28, 2021
a1d903f
refactor: [WIP] addressed SonarCloud detected code smells in Rollbar …
akornich Oct 28, 2021
3daf4bf
refactor: [WIP] addressed SonarCloud detected code smells in Rollbar …
akornich Oct 29, 2021
5abacc5
refactor: [WIP] addressed SonarCloud detected code smells in Rollbar …
akornich Oct 30, 2021
dc91c85
refactor: [WIP] addressed SonarCloud detected code smells in Rollbar …
akornich Oct 30, 2021
f4e0f39
refactor: addressed SonarCloud detected code smells in Rollbar module
akornich Nov 1, 2021
da1a170
refactor: unit tests cleanup
akornich Nov 1, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 71 additions & 82 deletions Rollbar.App.Config/AppConfigUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public static class AppConfigUtility
/// </summary>
/// <param name="config">The configuration.</param>
/// <returns>false when the configuration was not found, otherwise true.</returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Minor Code Smell", "S4136:Method overloads should be grouped together", Justification = "Intentionally split by settings kind.")]
public static bool LoadAppSettings(RollbarInfrastructureConfig config)
{
return AppConfigUtility.LoadAppSettings(config, RollbarConfigSection.GetConfiguration());
Expand All @@ -36,191 +37,179 @@ public static bool LoadAppSettings(RollbarInfrastructureConfig config, RollbarCo
return false;
}

// infrastructure options:
//////////////////////////

RollbarInfrastructureOptions infrastructureOptions = new RollbarInfrastructureOptions();
LoadInfrastructureOptions(config, rollbarConfigSection);
LoadOfflinePayloadStoreOptions(config, rollbarConfigSection);
LoadDestinationOptions(config, rollbarConfigSection);
LoadDeveloperOptions(config, rollbarConfigSection);
LoadHttpProxyOptions(config, rollbarConfigSection);
LoadDataSecurityOptions(config, rollbarConfigSection);
LoadTelemetryOptions(config);

if(rollbarConfigSection.MaxReportsPerMinute.HasValue)
var validationResults = config.Validate();
bool configLoadingResult =
(validationResults == null) || (validationResults.Count == 0);
Debug.Assert(configLoadingResult);
return configLoadingResult;
}

private static void LoadInfrastructureOptions(RollbarInfrastructureConfig config, RollbarConfigSection rollbarConfigSection)
{
RollbarInfrastructureOptions infrastructureOptions = new();

if (rollbarConfigSection.MaxReportsPerMinute.HasValue)
{
infrastructureOptions.MaxReportsPerMinute = rollbarConfigSection.MaxReportsPerMinute.Value;
}

if(rollbarConfigSection.ReportingQueueDepth.HasValue)
if (rollbarConfigSection.ReportingQueueDepth.HasValue)
{
infrastructureOptions.ReportingQueueDepth = rollbarConfigSection.ReportingQueueDepth.Value;
}

if(rollbarConfigSection.MaxItems.HasValue)
if (rollbarConfigSection.MaxItems.HasValue)
{
infrastructureOptions.MaxItems = rollbarConfigSection.MaxItems.Value;
}

if(rollbarConfigSection.CaptureUncaughtExceptions.HasValue)
if (rollbarConfigSection.CaptureUncaughtExceptions.HasValue)
{
infrastructureOptions.CaptureUncaughtExceptions = rollbarConfigSection.CaptureUncaughtExceptions.Value;
}

if(rollbarConfigSection.PayloadPostTimeout.HasValue)
if (rollbarConfigSection.PayloadPostTimeout.HasValue)
{
infrastructureOptions.PayloadPostTimeout = rollbarConfigSection.PayloadPostTimeout.Value;
}

config.RollbarInfrastructureOptions.Reconfigure(infrastructureOptions);
}

// telemetry options:
/////////////////////

RollbarTelemetryOptions telemetryOptions = new RollbarTelemetryOptions();
if(AppConfigUtility.LoadAppSettings(telemetryOptions))
{
config.RollbarTelemetryOptions.Reconfigure(telemetryOptions);
}
private static void LoadOfflinePayloadStoreOptions(RollbarInfrastructureConfig config, RollbarConfigSection rollbarConfigSection)
{
RollbarOfflineStoreOptions offlineStoreOptions = new();

//if(telemetryConfigSection.TelemetryEnabled.HasValue)
//{
// telemetryOptions.TelemetryEnabled = telemetryConfigSection.TelemetryEnabled.Value;
//}
//if(telemetryConfigSection.TelemetryQueueDepth.HasValue)
//{
// telemetryOptions.TelemetryQueueDepth = telemetryConfigSection.TelemetryQueueDepth.Value;
//}
//if(telemetryConfigSection.TelemetryAutoCollectionTypes.HasValue)
//{
// telemetryOptions.TelemetryAutoCollectionTypes = telemetryConfigSection.TelemetryAutoCollectionTypes.Value;
//}
//if(telemetryConfigSection.TelemetryAutoCollectionInterval.HasValue)
//{
// telemetryOptions.TelemetryAutoCollectionInterval = telemetryConfigSection.TelemetryAutoCollectionInterval.Value;
//}

//config.RollbarTelemetryOptions.Reconfigure(telemetryOptions);

// offline payload store options:
/////////////////////////////////

RollbarOfflineStoreOptions offlineStoreOptions = new RollbarOfflineStoreOptions();

if(rollbarConfigSection.EnableLocalPayloadStore.HasValue)
if (rollbarConfigSection.EnableLocalPayloadStore.HasValue)
{
offlineStoreOptions.EnableLocalPayloadStore = rollbarConfigSection.EnableLocalPayloadStore.Value;
}

if(!string.IsNullOrWhiteSpace(rollbarConfigSection.LocalPayloadStoreFileName))
if (!string.IsNullOrWhiteSpace(rollbarConfigSection.LocalPayloadStoreFileName))
{
offlineStoreOptions.LocalPayloadStoreFileName = rollbarConfigSection.LocalPayloadStoreFileName;
}

if(!string.IsNullOrWhiteSpace(rollbarConfigSection.LocalPayloadStoreLocationPath))
if (!string.IsNullOrWhiteSpace(rollbarConfigSection.LocalPayloadStoreLocationPath))
{
offlineStoreOptions.LocalPayloadStoreLocationPath = rollbarConfigSection.LocalPayloadStoreLocationPath;
}

config.RollbarOfflineStoreOptions.Reconfigure(offlineStoreOptions);
}

// logger destination options:
//////////////////////////////

if(!string.IsNullOrWhiteSpace(rollbarConfigSection.AccessToken))
private static void LoadDestinationOptions(RollbarInfrastructureConfig config, RollbarConfigSection rollbarConfigSection)
{
if (!string.IsNullOrWhiteSpace(rollbarConfigSection.AccessToken))
{
RollbarDestinationOptions destinationOptions =
new RollbarDestinationOptions(rollbarConfigSection.AccessToken);
RollbarDestinationOptions destinationOptions = new(rollbarConfigSection.AccessToken);

if(!string.IsNullOrWhiteSpace(rollbarConfigSection.Environment))
if (!string.IsNullOrWhiteSpace(rollbarConfigSection.Environment))
{
destinationOptions.Environment = rollbarConfigSection.Environment;
}

if(!string.IsNullOrWhiteSpace(rollbarConfigSection.EndPoint))
if (!string.IsNullOrWhiteSpace(rollbarConfigSection.EndPoint))
{
destinationOptions.EndPoint = rollbarConfigSection.EndPoint;
}

config.RollbarLoggerConfig.RollbarDestinationOptions.Reconfigure(destinationOptions);
}
}

// logger developer options:
////////////////////////////

if(rollbarConfigSection.Enabled.HasValue)
private static void LoadDeveloperOptions(RollbarInfrastructureConfig config, RollbarConfigSection rollbarConfigSection)
{
if (rollbarConfigSection.Enabled.HasValue)
{
config.RollbarLoggerConfig.RollbarDeveloperOptions.Enabled = rollbarConfigSection.Enabled.Value;
}

if(rollbarConfigSection.Transmit.HasValue)
if (rollbarConfigSection.Transmit.HasValue)
{
config.RollbarLoggerConfig.RollbarDeveloperOptions.Transmit = rollbarConfigSection.Transmit.Value;
}

if(rollbarConfigSection.RethrowExceptionsAfterReporting.HasValue)
if (rollbarConfigSection.RethrowExceptionsAfterReporting.HasValue)
{
config.RollbarLoggerConfig.RollbarDeveloperOptions.RethrowExceptionsAfterReporting = rollbarConfigSection.RethrowExceptionsAfterReporting.Value;
}

if(rollbarConfigSection.LogLevel.HasValue)
if (rollbarConfigSection.LogLevel.HasValue)
{
config.RollbarLoggerConfig.RollbarDeveloperOptions.LogLevel = rollbarConfigSection.LogLevel.Value;
}
}

// logger HTTP proxy options:
/////////////////////////////

if(!string.IsNullOrWhiteSpace(rollbarConfigSection.ProxyAddress))
private static void LoadHttpProxyOptions(RollbarInfrastructureConfig config, RollbarConfigSection rollbarConfigSection)
{
if (!string.IsNullOrWhiteSpace(rollbarConfigSection.ProxyAddress))
{
HttpProxyOptions httpProxyOptions = new HttpProxyOptions(rollbarConfigSection.ProxyAddress);
HttpProxyOptions httpProxyOptions = new(rollbarConfigSection.ProxyAddress);

if(!string.IsNullOrWhiteSpace(rollbarConfigSection.ProxyUsername))
if (!string.IsNullOrWhiteSpace(rollbarConfigSection.ProxyUsername))
{
httpProxyOptions.ProxyUsername = rollbarConfigSection.ProxyUsername;
}

if(!string.IsNullOrWhiteSpace(rollbarConfigSection.ProxyPassword))
if (!string.IsNullOrWhiteSpace(rollbarConfigSection.ProxyPassword))
{
httpProxyOptions.ProxyPassword = rollbarConfigSection.ProxyPassword;
}

config.RollbarLoggerConfig.HttpProxyOptions.Reconfigure(httpProxyOptions);
}
}

// logger data security options:
////////////////////////////////

RollbarDataSecurityOptions dataSecurityOptions = new RollbarDataSecurityOptions();
private static void LoadDataSecurityOptions(RollbarInfrastructureConfig config, RollbarConfigSection rollbarConfigSection)
{
RollbarDataSecurityOptions dataSecurityOptions = new();

if(rollbarConfigSection.ScrubFields != null && rollbarConfigSection.ScrubFields.Length > 0)
if (rollbarConfigSection.ScrubFields != null && rollbarConfigSection.ScrubFields.Length > 0)
{
dataSecurityOptions.ScrubFields =
string.IsNullOrEmpty(rollbarConfigSection.ScrubFields) ? new string[0]
string.IsNullOrEmpty(rollbarConfigSection.ScrubFields) ? Array.Empty<string>()
: rollbarConfigSection.ScrubFields.Split(listValueSplitters, StringSplitOptions.RemoveEmptyEntries);
}

if(rollbarConfigSection.ScrubSafelistFields != null && rollbarConfigSection.ScrubSafelistFields.Length > 0)
if (rollbarConfigSection.ScrubSafelistFields != null && rollbarConfigSection.ScrubSafelistFields.Length > 0)
{
dataSecurityOptions.ScrubSafelistFields =
string.IsNullOrEmpty(rollbarConfigSection.ScrubSafelistFields) ? new string[0]
string.IsNullOrEmpty(rollbarConfigSection.ScrubSafelistFields) ? Array.Empty<string>()
: rollbarConfigSection.ScrubSafelistFields.Split(listValueSplitters, StringSplitOptions.RemoveEmptyEntries);
}

if(rollbarConfigSection.PersonDataCollectionPolicies.HasValue)
if (rollbarConfigSection.PersonDataCollectionPolicies.HasValue)
{
dataSecurityOptions.PersonDataCollectionPolicies = rollbarConfigSection.PersonDataCollectionPolicies.Value;
}

if(rollbarConfigSection.IpAddressCollectionPolicy.HasValue)
if (rollbarConfigSection.IpAddressCollectionPolicy.HasValue)
{
dataSecurityOptions.IpAddressCollectionPolicy = rollbarConfigSection.IpAddressCollectionPolicy.Value;
}

config.RollbarLoggerConfig.RollbarDataSecurityOptions.Reconfigure(dataSecurityOptions);
}


var validationResults = config.Validate();
bool configLoadingResult =
(validationResults == null) || (validationResults.Count == 0);
Debug.Assert(configLoadingResult);
return configLoadingResult;
private static void LoadTelemetryOptions(RollbarInfrastructureConfig config)
{
RollbarTelemetryOptions telemetryOptions = new();
if (AppConfigUtility.LoadAppSettings(telemetryOptions))
{
config.RollbarTelemetryOptions.Reconfigure(telemetryOptions);
}
}


#endregion RollbarConfig

#region TelemetryConfig
Expand Down
2 changes: 1 addition & 1 deletion Rollbar.App.Config/RollbarConfigSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
public class RollbarConfigSection
: ConfigurationSection
{
private static readonly TraceSource traceSource = new TraceSource(typeof(RollbarConfigSection).FullName);
private static readonly TraceSource traceSource = new(typeof(RollbarConfigSection).FullName);

/// <summary>
/// Gets the configuration.
Expand Down
9 changes: 4 additions & 5 deletions Rollbar.App.Config/RollbarTelemetryConfigSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
public class RollbarTelemetryConfigSection
: ConfigurationSection
{
private static readonly TraceSource traceSource = new TraceSource(typeof(RollbarTelemetryConfigSection).FullName);
private static readonly TraceSource traceSource = new(typeof(RollbarTelemetryConfigSection).FullName);

/// <summary>
/// Gets the configuration.
Expand All @@ -34,11 +34,10 @@ public class RollbarTelemetryConfigSection
}
catch (System.Exception ex)
{
string msg = $"Error while attempting to get RollbarTelemetryConfigSection:{Environment.NewLine}{ex}";
//let's just trace it for now:
System.Diagnostics.Trace.TraceError(
"Error while attempting to get RollbarTelemetryConfigSection:" + System.Environment.NewLine + ex
);
traceSource.TraceEvent(TraceEventType.Warning, 0, $"Error while attempting to get RollbarTelemetryConfigSection:{Environment.NewLine}{ex}");
System.Diagnostics.Trace.TraceError(msg);
traceSource.TraceEvent(TraceEventType.Warning, 0, msg);
return null;
}
}
Expand Down
16 changes: 2 additions & 14 deletions Rollbar.AppSettings.Json/AppSettingsUtility.cs
Original file line number Diff line number Diff line change
D8D8 Expand Up @@ -208,8 +208,8 @@ public static bool LoadAppSettings(RollbarTelemetryOptions config, IConfiguratio
string fileFullName = Path.Combine(folderPath, appSettingsFileName);
if (!File.Exists(fileFullName))
{
//NOTE: the following line causes the RollbarTraceListener into infinite creation loop and subsequent stck overflow:
//Debug.WriteLine($"File: {fileFullName} does not exist...");
//NOTE: Do not Trace/Debug anything here,
// sinse it would cause the RollbarTraceListener into infinite creation loop and subsequent stack overflow!

return null;
}
Expand All @@ -222,18 +222,6 @@ public static bool LoadAppSettings(RollbarTelemetryOptions config, IConfiguratio
return appConfiguration;
}

/// <summary>
/// Loads the application settings.
/// </summary>
/// <typeparam name="TSection">The type of the t section.</typeparam>
/// <param name="sectionName">Name of the section.</param>
/// <param name="appSettings">The application settings.</param>
/// <returns>TSection.</returns>
private static TSection LoadAppSettings<TSection>(string sectionName, IConfiguration appSettings)
{
return appSettings.GetSection(sectionName).Get<TSection>();
}

/// <summary>
/// Loads the application settings.
/// </summary>
Expand Down
6 changes: 2 additions & 4 deletions Rollbar.AppSettings.Json/RollbarConfigurationUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ public static class RollbarConfigurationUtil
/// <returns></returns>
public static IRollbarInfrastructureConfig DeduceRollbarConfig(IConfiguration configuration)
{
//if (RollbarLocator.RollbarInstance.Config.RollbarDestinationOptions.AccessToken != null)
if (RollbarInfrastructure.Instance.Config?.RollbarLoggerConfig?.RollbarDestinationOptions?.AccessToken != null)
{
//return RollbarLocator.RollbarInstance.Config;
return RollbarInfrastructure.Instance.Config;
}

Expand All @@ -30,7 +28,7 @@ public static IRollbarInfrastructureConfig DeduceRollbarConfig(IConfiguration co
Assumption.AssertNotNull(configuration, nameof(configuration));

const string defaultAccessToken = "none";
RollbarInfrastructureConfig rollbarConfig = new RollbarInfrastructureConfig(defaultAccessToken);
RollbarInfrastructureConfig rollbarConfig = new(defaultAccessToken);
AppSettingsUtility.LoadAppSettings(rollbarConfig, configuration);

if (rollbarConfig.RollbarLoggerConfig.RollbarDestinationOptions.AccessToken == defaultAccessToken)
Expand Down Expand Up @@ -61,7 +59,7 @@ public static IRollbarInfrastructureConfig DeduceRollbarConfig 32E8 (IConfiguration co
/// <returns></returns>
public static IRollbarTelemetryOptions DeduceRollbarTelemetryConfig(IConfiguration configuration)
{
RollbarTelemetryOptions config = new RollbarTelemetryOptions();
RollbarTelemetryOptions config = new();
AppSettingsUtility.LoadAppSettings(config, configuration);

RollbarTelemetryCollector.Instance?.Config?.Reconfigure(config);
Expand Down
8 changes: 1 addition & 7 deletions Rollbar.Deploys/Internal/Deployment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@
/// <summary>
/// Models data used for registering a deployment instance.
/// </summary>
/// [TODO] Eventually, make this class internal AND remove all the [Obsolete] attributes ...
[Obsolete("This type is obsolete. Instead, use Rollbar.Deploys.IDeployment.", false)]
#pragma warning disable CA1724 // The type name conflicts with the namespace
public class Deployment
internal class Deployment
: IDeployment
#pragma warning restore CA1724 // The type name conflicts with the namespace
{
/// <summary>
/// Prevents a default instance of the <see cref="Deployment"/> class from being created.
Expand All @@ -25,7 +21,6 @@ private Deployment()
/// </summary>
/// <param name="environment">The environment.</param>
/// <param name="revision">The revision.</param>
[Obsolete("This constructor is obsolete. Instead, use Rollbar.Deploys.DeploymentFactory.CreateDeployment(...)", false)]
public Deployment(string environment, string revision)
: this(null, environment, revision)
{
Expand All @@ -38,7 +33,6 @@ public Deployment(string environment, string revision)
/// <param name="writeAccessToken">The write access token.</param>
/// <param name="environment">The environment.</param>
/// <param name="revision">The revision.</param>
[Obsolete("This constructor is obsolete. Instead, use Rollbar.Deploys.DeploymentFactory.CreateDeployment(...)", false)]
public Deployment(string? writeAccessToken, string? environment, string? revision)
{
this.WriteAccessToken = writeAccessToken;
Expand Down
Loading
0