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