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:
Jason Volk 2025-01-24 06:12:52 +00:00
parent 52adae7553
commit 6e7c73336c
4 changed files with 19 additions and 16 deletions

View file

@ -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(())
}