diff --git a/OnnxStack.Core/Config/ConfigManager.cs b/OnnxStack.Core/Config/ConfigManager.cs
index 81fdd01..f651739 100644
--- a/OnnxStack.Core/Config/ConfigManager.cs
+++ b/OnnxStack.Core/Config/ConfigManager.cs
@@ -9,6 +9,19 @@ namespace OnnxStack.Core.Config
{
public class ConfigManager
{
+ private static string _configurationBaseDirectory = AppDomain.CurrentDomain.BaseDirectory;
+
+
+ ///
+ /// Sets the configuration location.
+ ///
+ /// The base directory.
+ public static void SetConfiguration(string baseDirectory)
+ {
+ _configurationBaseDirectory = baseDirectory;
+ }
+
+
///
/// Loads the OnnxStackConfig configuration object from appsetting.json
///
@@ -88,19 +101,37 @@ private static JsonSerializerOptions GetSerializerOptions(params JsonConverter[]
return serializerOptions;
}
+
+ ///
+ /// Saves the configuration.
+ ///
+ /// The configuration.
public static void SaveConfiguration(OnnxStackConfig configuration)
{
SaveConfiguration(configuration);
}
+
+ ///
+ /// Saves the configuration.
+ ///
+ ///
+ /// The configuration.
public static void SaveConfiguration(T configuration) where T : class, IConfigSection
{
SaveConfiguration(typeof(T).Name, configuration);
}
+
+ ///
+ /// Saves the configuration.
+ ///
+ ///
+ /// Name of the section.
+ /// The configuration.
public static void SaveConfiguration(string sectionName, T configuration) where T : class, IConfigSection
{
-
+
string appsettingStreamFile = GetAppSettingsFile();
// Read In File
@@ -118,9 +149,14 @@ public static void SaveConfiguration(string sectionName, T configuration) whe
JsonSerializer.Serialize(appsettingWriteStream, appSettings, serializerOptions);
}
+
+ ///
+ /// Gets the application settings file.
+ ///
+ ///
private static string GetAppSettingsFile()
{
- return Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "appsettings.json");
+ return Path.Combine(_configurationBaseDirectory, "appsettings.json");
}
}
}