|
@@ -3,6 +3,8 @@ use crate::indexes::{SerializableMessage, SerializableThread};
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
use std::fs::File;
|
|
|
use std::io::{BufReader};
|
|
|
+use std::net::{IpAddr, SocketAddr};
|
|
|
+use std::str::FromStr;
|
|
|
use warp::Filter;
|
|
|
use warp::http::StatusCode;
|
|
|
use crate::{create_folder_lar, delete_folder_lar, rename_folder_lar};
|
|
@@ -48,7 +50,9 @@ pub async fn run_api() {
|
|
|
.and_then(delete_folder_handle))
|
|
|
.with(cors);
|
|
|
|
|
|
- warp::serve(routes).run(([127, 0, 0, 1], 3030)).await; // TODO from config
|
|
|
+ let ip: IpAddr = IpAddr::from_str(&*Config::global().api_addr.clone()).expect("Invalid API IP address");
|
|
|
+ let addr = SocketAddr::new(ip, Config::global().api_port.clone() as u16);
|
|
|
+ warp::serve(routes).run(addr).await;
|
|
|
}
|
|
|
|
|
|
pub async fn get_folders() -> String {
|