Add IP location service
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use std::net::IpAddr;
|
||||
|
||||
use actix_web::dev::Payload;
|
||||
use actix_web::{web, Error, FromRequest, HttpRequest};
|
||||
use actix_web::{Error, FromRequest, HttpRequest};
|
||||
use futures_util::future::{ready, Ready};
|
||||
|
||||
use crate::data::app_config::AppConfig;
|
||||
@@ -22,7 +22,9 @@ impl FromRequest for RemoteIP {
|
||||
|
||||
#[inline]
|
||||
fn from_request(req: &HttpRequest, _: &mut Payload) -> Self::Future {
|
||||
let config: &web::Data<AppConfig> = req.app_data().expect("AppData undefined!");
|
||||
ready(Ok(RemoteIP(get_remote_ip(req, config.proxy_ip.as_deref()))))
|
||||
ready(Ok(RemoteIP(get_remote_ip(
|
||||
req,
|
||||
AppConfig::get().proxy_ip.as_deref(),
|
||||
))))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user