-
Notifications
You must be signed in to change notification settings - Fork 396
Introduce RootConfig.validate_config()
which can be subclassed in HomeServerConfig
to do cross-config class validation
#19027
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce RootConfig.validate_config()
which can be subclassed in HomeServerConfig
to do cross-config class validation
#19027
Conversation
obj.invoke_all("read_arguments", config_args) | ||
|
||
return obj | ||
return cls.load_config(description, argv_options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change makes it so we go through the normal load_config(...)
code path instead of inventing yet another way to load config.
It also means we can settle on calling validate_config(...)
in one place as everything flows to load_config_with_parser(...)
now.
"spam and abuse. If you would like to allow public registration, please consider adding email, " | ||
"captcha, or token-based verification. Otherwise this check can be removed by setting the " | ||
"`enable_registration_without_verification` config option to `true`." | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only real change is that this has moved from a place that only runs for the main Synapse instance to everything including workers.
But I assume that's fine. We want the same warning for workers as we wouldn't want open registration there either.
setup
to load_or_generate_config
RootConfig.validate_config()
which can be subclassed in HomeServerConfig
to do cross-config class validation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice idea. I support it.
We should ensure that we don't end up changing config option values in validate_config
, else we once again won't be able to cross-validate on the final config set.
Co-authored-by: Andrew Morgan <[email protected]>
…github.com:element-hq/synapse into madlittlemods/relocate-snowflake-config-validation
…alidation Conflicts: synapse/app/homeserver.py tests/config/test_registration_config.py
Thanks for the review @anoadragon453 🦋 |
Introduce
RootConfig.validate_config()
which can be subclassed inHomeServerConfig
to do cross-config class validation. This means we can move the open registration config validation fromsetup()
toHomeServerConfig.validate_config()
(much more sane).Spawning from looking at this area of code in #19015
Dev notes
Open registration validation introduced in matrix-org/synapse#12091
Pull Request Checklist
EventStore
toEventWorkerStore
.".code blocks
.