From cd9a2d6247c0c151d0497574fc4a9fec06630673 Mon Sep 17 00:00:00 2001 From: alemi Date: Tue, 6 Aug 2024 23:01:44 +0200 Subject: [PATCH] fix: lib name is codemp_lua, override addr via env use CODEMP_SERVER_ADDRESS --- src/ffi/lua.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ffi/lua.rs b/src/ffi/lua.rs index 7b5d66f..287f8b8 100644 --- a/src/ffi/lua.rs +++ b/src/ffi/lua.rs @@ -19,8 +19,9 @@ struct GlobalState { impl Default for GlobalState { fn default() -> Self { let rt = Runtime::new().expect("could not create tokio runtime"); + let addr = std::env::var("CODEMP_SERVER_ADDRESS").unwrap_or_else(|_|"http://codemp.alemi.dev:50053".to_string()); let client = rt.block_on( - CodempClient::new("http://codemp.alemi.dev:50053") + CodempClient::new(&addr) ).expect("could not connect to codemp servers"); GlobalState { client: std::sync::RwLock::new(client), runtime: rt } } @@ -248,7 +249,7 @@ fn setup_tracing(_: &Lua, (debug,): (Option,)) -> LuaResult { // define module and exports #[mlua::lua_module] -fn libcodemp(lua: &Lua) -> LuaResult { +fn codemp_lua(lua: &Lua) -> LuaResult { let exports = lua.create_table()?; // core proto functions