@@ -188,28 +188,38 @@ private void InitializeInstallConfig()
188188 _installConfig . Id = Guid . NewGuid ( ) ;
189189 }
190190
191- // if this is a new install or replacing a pre V2.1 version
192- // or there is an install file, then we need to install the initial modules.
193- if ( string . IsNullOrEmpty ( _installConfig . Version ) ||
194- File . Exists ( ModuleInstaller . InstallModulesFileName ) )
191+ // If the 'installmodules.json' file exists then we need to install the modules listed
192+ if ( File . Exists ( ModuleInstaller . InstallModulesFileName ) )
195193 {
196- _logger ? . LogDebug ( $ "Initial module install list exists (or no initial install version) ") ;
194+ _logger ? . LogDebug ( $ "Found a list of (initial) modules to install") ;
197195 ModuleInstaller . QueueInitialModulesInstallation ( ) ;
198196 }
199197
198+ // If there is no install config value, then no install happened. Run it. NOTE: in
199+ // Docker, there will be no install config, but installs were done.
200+ if ( ! SystemInfo . IsDocker && string . IsNullOrEmpty ( _installConfig . Version ) )
201+ {
202+ _logger ? . LogDebug ( $ "No record of a previous module installation found. Running install") ;
203+ ModuleInstaller . QueueInitialModulesInstallation ( ) ;
204+ }
205+
200206 _installConfig . Version = _versionConfig ? . VersionInfo ? . Version ?? string . Empty ;
201207
202- // If we are running in a Docker container and the container ID has changed,
203- // then we need to reinstall the modules.
204- if ( SystemInfo . IsDocker &&
205- ( string . IsNullOrEmpty ( _installConfig . DockerContainerId ) ||
206- _installConfig . DockerContainerId != SystemInfo . DockerContainerId ) )
208+ // If we are running in a Docker container and the container ID has changed, then we
209+ // need to reinstall the modules.
210+ if ( SystemInfo . IsDocker )
207211 {
208- _installConfig . DockerContainerId = SystemInfo . DockerContainerId ;
209- ModuleInstaller . QueueReinstallModules ( ) ;
212+ if ( string . IsNullOrEmpty ( _installConfig . DockerContainerId ) )
213+ {
214+ _installConfig . DockerContainerId = SystemInfo . DockerContainerId ;
215+ }
216+ else if ( _installConfig . DockerContainerId != SystemInfo . DockerContainerId )
217+ {
218+ _installConfig . DockerContainerId = SystemInfo . DockerContainerId ;
219+ ModuleInstaller . QueueReinstallModules ( ) ;
220+ }
210221 }
211222
212-
213223 var configValues = new { install = _installConfig } ;
214224 string appDataDir = Configuration [ "ApplicationDataDir" ]
215225 ?? throw new ArgumentNullException ( "ApplicationDataDir is not defined in configuration" ) ;
0 commit comments