From 3b7f738543c6104e20e93aeca9131c96234cf535 Mon Sep 17 00:00:00 2001 From: dutchie032 Date: Wed, 11 Sep 2024 19:40:50 +0200 Subject: [PATCH] cleaned up PR --- lua/DCS-gRPC/grpc.lua | 26 -------------------------- src/authentication.rs | 2 +- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/lua/DCS-gRPC/grpc.lua b/lua/DCS-gRPC/grpc.lua index 9e47b9b..b6ee79b 100644 --- a/lua/DCS-gRPC/grpc.lua +++ b/lua/DCS-gRPC/grpc.lua @@ -8,32 +8,6 @@ end -- load and start RPC -- -function table_print(tt, indent, done) - done = done or {} - indent = indent or 0 - if type(tt) == "table" then - local sb = {} - for key, value in pairs(tt) do - table.insert(sb, string.rep(" ", indent)) -- indent it - if type(value) == "table" and not done[value] then - done[value] = true - table.insert(sb, key .. " = {\n"); - table.insert(sb, table_print(value, indent + 2, done)) - table.insert(sb, string.rep(" ", indent)) -- indent it - table.insert(sb, "}\n"); - elseif "number" == type(key) then - table.insert(sb, string.format("\"%s\"\n", tostring(value))) - else - table.insert(sb, string.format( - "%s = \"%s\"\n", tostring(key), tostring(value))) - end - end - return table.concat(sb) - else - return tt .. "\n" - end -end - if isMissionEnv then assert(grpc.start({ version = GRPC.version, diff --git a/src/authentication.rs b/src/authentication.rs index ca2b290..69dde31 100644 --- a/src/authentication.rs +++ b/src/authentication.rs @@ -12,7 +12,7 @@ pub struct AuthInterceptor { #[async_trait] impl RequestInterceptor for AuthInterceptor { async fn intercept(&self, req: Request) -> Result, Status> { - match req.headers().get("bearer").map(|v| v.to_str()) { + match req.headers().get("X-API-Key").map(|v| v.to_str()) { Some(Ok(token)) => { //check if token is correct if auth is enabled if self.auth_config.enabled == false || token == self.auth_config.token {