Updates configuration and refactors code structure
Migrates connection strings to new database host Removes unnecessary code and improves configuration handling Enhances test coverage and adds random word generation Updates telemetry and command handling patterns
This commit is contained in:
parent
dc98178095
commit
a991dcdb97
18 changed files with 481 additions and 63 deletions
|
|
@ -35,8 +35,4 @@ public class CommandResponse(Guid correlationId, string commandName, Guid? trans
|
|||
/// </summary>
|
||||
public DateTime CreatedAt { get; } = DateTime.UtcNow;
|
||||
|
||||
/// <summary>
|
||||
/// A URL where the client can check the status of the command. This is typically used in asynchronous operations.
|
||||
/// </summary>
|
||||
public string StatusUrl { get; } = "statusUrl";
|
||||
}
|
||||
|
|
@ -63,7 +63,7 @@ namespace PlanTempus.Core.Configurations
|
|||
if (test != null)
|
||||
value = test.ToString();
|
||||
}
|
||||
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
@ -99,7 +99,7 @@ namespace PlanTempus.Core.Configurations
|
|||
|
||||
return new ConfigurationSection { Path = path, Key = path.Split(':').Last(), Value = value };
|
||||
}
|
||||
public static T Get<T>(this IConfigurationRoot configuration, string path)
|
||||
public static T Get<T>(this IConfigurationRoot configuration, string path, bool optional = true)
|
||||
{
|
||||
JToken value = null;
|
||||
foreach (var provider in configuration.ConfigurationProviders)
|
||||
|
|
@ -109,6 +109,10 @@ namespace PlanTempus.Core.Configurations
|
|||
if (test != null)
|
||||
value = test;
|
||||
}
|
||||
if(value is null && !optional)
|
||||
throw new Exceptions.ConfigurationException($"Path not found in configuration, path: {path}");
|
||||
if (value is null)
|
||||
return default;
|
||||
|
||||
return value.ToObject<T>();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue