|
3 | 3 | using System.Net.Http.Json; |
4 | 4 |
|
5 | 5 | using CodeProject.AI.SDK.API; |
6 | | -using CodeProject.AI.SDK.Common; |
7 | 6 | using CodeProject.AI.SDK.Utils; |
8 | 7 |
|
9 | 8 | using Microsoft.Extensions.Configuration; |
@@ -104,6 +103,23 @@ public ModuleWorkerBase(ILogger logger, IConfiguration configuration, |
104 | 103 | string currentModuleDirPath = GetModuleDirectoryPath(); |
105 | 104 | string currentDirName = new DirectoryInfo(currentModuleDirPath).Name; |
106 | 105 |
|
| 106 | + // TODO: We could load the settings directly from the modulesettings files rather than rely |
| 107 | + // rely environment variables: |
| 108 | + /* |
| 109 | + // Load up the module's settings and start the module |
| 110 | + var config = new ConfigurationBuilder(); |
| 111 | + config.AddModuleSettingsConfigFiles(moduleDirPath, false); |
| 112 | + IConfiguration configuration = config.Build(); |
| 113 | +
|
| 114 | + // Bind the values in the configuration to a ModuleConfig object |
| 115 | + string moduleId = [get module id from config] |
| 116 | + var moduleConfig = new ModuleConfig(); |
| 117 | + configuration.Bind($"Modules:{moduleId}", moduleConfig); |
| 118 | +
|
| 119 | + // Complete the ModuleConfig's setup. |
| 120 | + if (moduleConfig.Initialise(moduleId, moduleDirPath, ModuleLocation.Internal)) |
| 121 | + */ |
| 122 | + |
107 | 123 | _moduleId = configuration.GetValue<string?>("CPAI_MODULE_ID", null) ?? currentDirName; |
108 | 124 | ModuleName = configuration.GetValue<string?>("CPAI_MODULE_NAME", null) ?? _moduleId; |
109 | 125 | moduleDirPath = configuration.GetValue<string?>("CPAI_MODULE_PATH", null) ?? currentModuleDirPath; |
|
0 commit comments