diff options
| author | Sho Sakuma <me@m1sk9.dev> | 2026-08-03 15:16:39 +0900 |
|---|---|---|
| committer | Sho Sakuma <me@m1sk9.dev> | 2026-08-05 01:16:03 +0900 |
| commit | 576c057bb98dab27c2b97931fc5635603fe1bf57 (patch) | |
| tree | 115faef961f9fb8cf801370e77f33921f5b436b4 /engine | |
| parent | daf9060561656f468a0ae366e5695f5eb74f48f7 (diff) | |
| download | LunaticChat-576c057bb98dab27c2b97931fc5635603fe1bf57.tar.gz LunaticChat-576c057bb98dab27c2b97931fc5635603fe1bf57.tar.bz2 LunaticChat-576c057bb98dab27c2b97931fc5635603fe1bf57.zip | |
refactor: read config.yml into the config classes directly
Every setting's default was written three times - in config.yml, in the
ConfigManager getter call, and on the data class - and copying the file
key by key is what made that necessary. They had already drifted:
checkForUpdates defaulted to false in ConfigManager while both config.yml
and the data class said true.
Worse, features.channelChat.messageLogging was documented in config.yml
with three settings and never parsed at all. ConfigManager did not build
it, so ChannelMessageLoggingConfig() always won and an operator editing
retentionDays or maxFileSizeMB changed nothing. Those settings now take
effect - the documented behaviour, but a real change for anyone whose file
disagrees with the defaults.
KAML deserializes the file straight into the tree, the same way player
settings and channel data are already read, so a default now lives only on
the data class. Two consequences worth stating:
- japaneseConversion.cache and .api are nested classes now, because the
data has to match the file rather than the file being flattened by hand
on the way in. The YAML is unchanged.
- api.retryAttempts is gone from config.yml. It was parsed and stored, but
never reached GoogleIMEClient or RomanjiConverter, so it documented a
knob that did nothing.
Unknown keys are ignored and a malformed file falls back to defaults with
a log line, so neither an old config nor a typo stops the server booting.
The tests parse real YAML instead of a mocked FileConfiguration, which
lets them cover what the mock could not: a partial file, a retired key, a
malformed document, and - the one that would have caught the drift above -
that the bundled config.yml equals the declared defaults.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat (limited to 'engine')
0 files changed, 0 insertions, 0 deletions
