mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2024-11-26 16:33:44 +00:00
move these config checks to main.rs
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
0ea8657070
commit
dac8b3db49
|
@ -257,14 +257,6 @@ impl KeyValueDatabase {
|
|||
}
|
||||
};
|
||||
|
||||
if config.registration_token == Some(String::new()) {
|
||||
return Err(Error::bad_config("Registration token is empty"));
|
||||
}
|
||||
|
||||
if config.max_request_size < 4096 {
|
||||
error!(?config.max_request_size, "Max request size is less than 4KB. Please increase it.");
|
||||
}
|
||||
|
||||
let (presence_sender, presence_receiver) = mpsc::unbounded_channel();
|
||||
|
||||
let db_raw = Box::new(Self {
|
||||
|
|
10
src/main.rs
10
src/main.rs
|
@ -153,6 +153,16 @@ async fn main() {
|
|||
|
||||
/* ad-hoc config validation/checks */
|
||||
|
||||
// check if the user specified a registration token as `""`
|
||||
if config.registration_token == Some(String::new()) {
|
||||
error!("Registration token was specified but is empty (\"\")");
|
||||
return;
|
||||
}
|
||||
|
||||
if config.max_request_size < 4096 {
|
||||
error!(?config.max_request_size, "Max request size is less than 4KB. Please increase it.");
|
||||
}
|
||||
|
||||
// check if user specified valid IP CIDR ranges on startup
|
||||
for cidr in services().globals.ip_range_denylist() {
|
||||
let _ = ipaddress::IPAddress::parse(cidr)
|
||||
|
|
Loading…
Reference in a new issue