fix(gateway): inject X-Tool-Server-API-Key header to tools/local fetch restClient
Some checks failed
Deploy to OCIWP / deploy (push) Has been cancelled
Some checks failed
Deploy to OCIWP / deploy (push) Has been cancelled
This commit is contained in:
@@ -20,6 +20,7 @@ import io.shinhanlife.dap.lib.adapter.dto.JsonRpcRequest;
|
||||
import io.shinhanlife.dap.lib.adapter.dto.JsonRpcResponse;
|
||||
import io.shinhanlife.dap.lib.adapter.dto.Params;
|
||||
import io.shinhanlife.dap.mcg.config.GatewayFallbackProperties;
|
||||
import io.shinhanlife.dap.mcg.config.McpGatewayProperties;
|
||||
import io.shinhanlife.dap.mcc.dto.ToolMetadata;
|
||||
import io.shinhanlife.dap.mcg.registry.InMemoryRegistryService;
|
||||
import io.shinhanlife.dap.mcg.service.ExecuteService;
|
||||
@@ -60,7 +61,8 @@ public class McpRouterController {
|
||||
ExecuteService executeService,
|
||||
SecurityProperties securityProperties,
|
||||
ObjectMapper objectMapper,
|
||||
GatewayFallbackProperties gatewayFallbackProperties) {
|
||||
GatewayFallbackProperties gatewayFallbackProperties,
|
||||
McpGatewayProperties mcpGatewayProperties) {
|
||||
this.registryService = registryService;
|
||||
this.executeService = executeService;
|
||||
this.securityProperties = securityProperties;
|
||||
@@ -72,7 +74,15 @@ public class McpRouterController {
|
||||
factory.setConnectTimeout(1000); // 연결 시도 타임아웃 1초
|
||||
factory.setReadTimeout(1000); // 응답 대기 타임아웃 1초
|
||||
|
||||
this.restClient = RestClient.builder().requestFactory(factory).build();
|
||||
String apiKey = mcpGatewayProperties.toolServerApiKey();
|
||||
if (apiKey == null || apiKey.isEmpty()) {
|
||||
apiKey = "tool-server-key";
|
||||
}
|
||||
|
||||
this.restClient = RestClient.builder()
|
||||
.requestFactory(factory)
|
||||
.defaultHeader("X-Tool-Server-API-Key", apiKey)
|
||||
.build();
|
||||
}
|
||||
|
||||
@PostMapping("/tools/call")
|
||||
|
||||
Reference in New Issue
Block a user