move room version config check out of services.globals
make available_room_versions() non-member associated Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
52adae7553
commit
6e7c73336c
4 changed files with 19 additions and 16 deletions
|
@ -4,7 +4,7 @@ use either::Either;
|
|||
use figment::Figment;
|
||||
|
||||
use super::DEPRECATED_KEYS;
|
||||
use crate::{debug, debug_info, debug_warn, error, warn, Config, Err, Result};
|
||||
use crate::{debug, debug_info, debug_warn, error, warn, Config, Err, Result, Server};
|
||||
|
||||
#[allow(clippy::cognitive_complexity)]
|
||||
pub fn check(config: &Config) -> Result<()> {
|
||||
|
@ -233,6 +233,16 @@ pub fn check(config: &Config) -> Result<()> {
|
|||
}
|
||||
}
|
||||
|
||||
if !Server::available_room_versions()
|
||||
.any(|(version, _)| version == config.default_room_version)
|
||||
{
|
||||
return Err!(Config(
|
||||
"default_room_version",
|
||||
"Room version {:?} is not available",
|
||||
config.default_room_version
|
||||
));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue