From ab327a9e09917af20c2b53271306f5bdaf0ec213 Mon Sep 17 00:00:00 2001 From: yaoxuwan Date: Tue, 17 Dec 2024 10:01:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20fs=E5=AE=A2=E6=88=B7=E7=AB=AF=E5=BF=83?= =?UTF-8?q?=E8=B7=B3=E6=94=AF=E6=8C=81=E4=B8=8A=E6=8A=A5ip=20#2862?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tencent/bkrepo/fs/server/request/ClientCreateRequest.kt | 1 + .../com/tencent/bkrepo/fs/server/service/ClientService.kt | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/request/ClientCreateRequest.kt b/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/request/ClientCreateRequest.kt index 0fb3c8682c..322d6e6cac 100644 --- a/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/request/ClientCreateRequest.kt +++ b/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/request/ClientCreateRequest.kt @@ -41,4 +41,5 @@ data class ClientCreateRequest( val version: String, val os: String, val arch: String, + val ip: String?, ) diff --git a/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/service/ClientService.kt b/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/service/ClientService.kt index 9735a7c9c0..c42fcc8efb 100644 --- a/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/service/ClientService.kt +++ b/src/backend/fs/boot-fs-server/src/main/kotlin/com/tencent/bkrepo/fs/server/service/ClientService.kt @@ -67,7 +67,7 @@ class ClientService( suspend fun createClient(request: ClientCreateRequest): ClientDetail { with(request) { - val ip = ReactiveRequestContextHolder.getClientAddress() + val ip = if (this.ip.isNullOrBlank()) ReactiveRequestContextHolder.getClientAddress() else this.ip val query = Query( Criteria.where(TClient::projectId.name).isEqualTo(projectId) .and(TClient::repoName.name).isEqualTo(repoName) @@ -277,7 +277,8 @@ class ClientService( mountPoint = client.mountPoint, version = client.version, os = client.os, - arch = client.arch + arch = client.arch, + ip = client.ip ) }