feat(bootstrap): OnConfigLoaded hook to inspect and override loaded config#50
Merged
Conversation
…onfig sections The config manager raises ConfigLoaded after every Load, and the bootstrap re-applies the registered typed hooks - surviving the second Load performed by the config manager service during startup. Overrides are in-memory only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The config manager loads YAML transparently - you could not see the values nor tweak them at startup. New typed hook on the bootstrap:
IConfigManagerService.ConfigLoadedevent raised at the end ofLoad()- this makes hooks survive the second Load that the config manager's ownStartAsyncperforms during startup (fresh instances would otherwise wipe the overrides).Save()stays explicit). Default behavior unchanged with zero hooks.ConfigureServices).Compose()(YAML dump of current values) andGetConfig<T>()in the configuration guide, with three verified examples; lifecycle concept updated (load -> hooks -> logger -> services); tutorial cross-link; Services.Core README snippet.Test Plan
OnConfigLoaded_SurvivesTheSecondLoad(counter >= 2 across the double Load) andOnConfigLoaded_DoesNotRewriteYamlFile(disk vs memory)Follow-ups noted (non-blocking)
ApplyConfigHookscould guard_disposedfor externally-owned containers