use crate::app::config::Configuration;
use crate::rate_limiter::RateLimiter;
use rocket::Build;
use rocket::Rocket;

pub fn init(config: &Configuration) -> super::InfallibleResult<RateLimiter> {
    Ok(Some(RateLimiter::new(config.mail_rate_limit)))
}

pub fn register(
    rocket: Rocket<Build>,
    _config: &Configuration,
    state: RateLimiter,
) -> Rocket<Build> {
    rocket.manage(state)
}
