mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 04:04:43 +08:00
fix(router): added validation check to number of workers in config (#3533)
This commit is contained in:
@ -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(),
|
||||||
|
))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user