refactor(http)!: get address from lua

This commit is contained in:
2025-03-10 18:58:14 -04:00
parent caec5fa7f8
commit 18540aa223
3 changed files with 7 additions and 9 deletions

View File

@@ -16,6 +16,7 @@ use hyper_util::rt::TokioIo;
use log::{debug, error, info, trace};
use mlua::{Error, Function, IntoLuaMulti, Table};
use ncr::utils::trim_header;
use std::net::SocketAddr;
use tokio::net::TcpListener;
#[allow(clippy::too_many_lines)]
@@ -191,7 +192,11 @@ pub async fn handle_event(client: Client, event: Event, state: State) -> anyhow:
)?;
call_listeners(&state, "init", ()).await;
let Some(address) = state.http_address else {
let Some(address): Option<SocketAddr> = globals
.get::<String>("HttpAddress")
.ok()
.and_then(|string| string.parse().ok())
else {
return Ok(());
};