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:
@@ -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(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user