1111using Microsoft . Extensions . Options ;
1212using Microsoft . OpenApi . Models ;
1313
14- using CodeProject . SenseAI . API . Common ;
1514using CodeProject . SenseAI . API . Server . Backend ;
1615
1716namespace CodeProject . SenseAI . API . Server . Frontend
@@ -85,9 +84,11 @@ public void ConfigureServices(IServiceCollection services)
8584 services . Configure < BackendOptions > ( Configuration . GetSection ( nameof ( BackendOptions ) ) )
8685 . AddQueueProcessing ( ) ;
8786
88- services . Configure < VersionInfo > ( Configuration . GetSection ( nameof ( VersionInfo ) ) ) ;
87+ // Moved into its own file
88+ // services.Configure<VersionInfo>(Configuration.GetSection(nameof(VersionInfo)));
8989
9090 services . Configure < InstallConfig > ( Configuration . GetSection ( InstallConfig . InstallCfgSection ) ) ;
91+ services . Configure < VersionConfig > ( Configuration . GetSection ( VersionConfig . VersionCfgSection ) ) ;
9192
9293 services . AddBackendProcessRunner ( Configuration ) ;
9394
@@ -116,7 +117,7 @@ public void Configure(IApplicationBuilder app,
116117 app . UseSwaggerUI ( c => c . SwaggerEndpoint ( "/swagger/v1/swagger.json" , "CodeProject SenseAI API v1" ) ) ;
117118 }
118119
119- InitializeIntallConfig ( installConfig . Value , logger ) ;
120+ InitializeInstallConfig ( installConfig . Value , logger ) ;
120121
121122 bool forceHttps = Configuration . GetValue < bool > ( nameof ( forceHttps ) ) ;
122123 if ( forceHttps )
@@ -137,7 +138,7 @@ public void Configure(IApplicationBuilder app,
137138 } ) ;
138139 }
139140
140- private static void InitializeIntallConfig ( InstallConfig installConfig , ILogger < Startup > logger )
141+ private static void InitializeInstallConfig ( InstallConfig installConfig , ILogger < Startup > logger )
141142 {
142143
143144 if ( installConfig is null || installConfig . Id == Guid . Empty )
@@ -148,6 +149,7 @@ private static void InitializeIntallConfig(InstallConfig installConfig, ILogger<
148149 installConfig . Id = Guid . NewGuid ( ) ;
149150 var configValues = new { install = installConfig } ;
150151 var filePath = InstallConfig . InstallCfgFilename ;
152+
151153 File . WriteAllText ( filePath , System . Text . Json . JsonSerializer . Serialize ( configValues ,
152154 new System . Text . Json . JsonSerializerOptions { WriteIndented = true } ) ) ;
153155 }
0 commit comments