Skip to content

Move database and plugin startup out of the service registration - #177

Merged
vesnicancz merged 1 commit into
masterfrom
refactor/bootstrap-out-of-dependency-injection
Nov 5, 2026
Merged

vesnicancz merged 1 commit into
masterfrom
refactor/bootstrap-out-of-dependency-injection

Conversation

@vesnicancz

Copy link
Copy Markdown
Owner

Infrastructure.DependencyInjection registered services, migrated the database and started plugins. Where a plugin's configuration comes from was decided twice, at startup and in the Settings dialog, and the two copies differed. The startup copy also read Plugins:Directories as the configuration of a plugin called Directories.

What changes

  • DatabaseInitializer takes over the database half, moved as it is. The backup and migration steps and their order don't change.
  • PluginStartup takes over loading and starting plugins, with explicit arguments instead of optional ones.
  • IPluginConfigurationSource is the one place that decides the source: a plugin saved in user settings gets exactly that, and Plugins:<id> from the configuration only provides initial values. Startup and SettingsOrchestrator both use it, and the orchestrator no longer needs IConfiguration.
  • Plugins:Directories is no longer treated as a plugin.

Behavior to check

The Settings dialog used to take only the keys of known fields from Plugins:<id>, while startup passed all of them. It now takes all of them too, so a plugin that has no saved settings yet keeps every key from the file once the dialog saves it. The dialog no longer drops those keys on save, which would have restarted the plugin with a different configuration. Nothing changes for a plugin already in user settings, and the settings file format is the same.

Testing

  • All 1447 tests pass on Windows, including new ones for the precedence and for Plugins:Directories. The migration tests, including ExistingDatabaseMigrationTests, now go through DatabaseInitializer.
  • I ran providers from the CLI and the Debug GUI for 20 seconds with the real development settings: all six plugins started. The only warnings were the hotkey and the Stream Deck pipe being taken by the installed app running at the same time.
  • Not tried: a real Plugins:<id> section in appsettings.json in a running app, which only the tests cover.

DependencyInjection registered services, migrated the database and started
plugins. DatabaseInitializer and PluginStartup now do the last two.

Where a plugin's configuration comes from was decided at startup and again in
the Settings dialog. IPluginConfigurationSource decides it for both, and no
longer reads Plugins:Directories as a plugin called Directories.
@vesnicancz
vesnicancz merged commit 342bc5c into master Nov 5, 2026
6 checks passed
@vesnicancz
vesnicancz deleted the refactor/bootstrap-out-of-dependency-injection branch November 5, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant