fix(router): added validation check to number of workers in config (#3533)

This commit is contained in:
Ravi Kiran
2024-02-07 14:49:20 +05:30
committed by GitHub
parent 926d084e44
commit c0e31ed1df

View File

@ -68,10 +68,18 @@ impl super::settings::Locker {
impl super::settings::Server { impl super::settings::Server {
pub fn validate(&self) -> Result<(), ApplicationError> { pub fn validate(&self) -> Result<(), ApplicationError> {
common_utils::fp_utils::when(self.host.is_default_or_empty(), || { use common_utils::fp_utils::when;
when(self.host.is_default_or_empty(), || {
Err(ApplicationError::InvalidConfigurationValueError( Err(ApplicationError::InvalidConfigurationValueError(
"server host must not be empty".into(), "server host must not be empty".into(),
)) ))
})?;
when(self.workers == 0, || {
Err(ApplicationError::InvalidConfigurationValueError(
"number of workers must be greater than 0".into(),
))
}) })
} }
} }