From 55b3650ad02ce75b6714b3c4891c19290075745c Mon Sep 17 00:00:00 2001 From: Oleg Kopysov Date: Mon, 7 Oct 2024 04:29:45 +0300 Subject: [PATCH] fix: Skip asking GH token for local scans (#635) Signed-off-by: Oleg Kopysov --- .../com/lpvs/service/LPVSGitHubConnectionService.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/lpvs/service/LPVSGitHubConnectionService.java b/src/main/java/com/lpvs/service/LPVSGitHubConnectionService.java index 4e58092e..7ac91aec 100644 --- a/src/main/java/com/lpvs/service/LPVSGitHubConnectionService.java +++ b/src/main/java/com/lpvs/service/LPVSGitHubConnectionService.java @@ -7,6 +7,7 @@ package com.lpvs.service; import com.lpvs.util.LPVSExitHandler; +import io.micrometer.common.util.StringUtils; import lombok.extern.slf4j.Slf4j; import org.kohsuke.github.GitHub; import org.springframework.beans.factory.annotation.Autowired; @@ -25,6 +26,12 @@ @Slf4j public class LPVSGitHubConnectionService { + /** + * Trigger value to start a single scan of local files or folder. + */ + @Value("${local.path:}") + private String localPath; + /** * GitHub login username. */ @@ -115,7 +122,7 @@ public LPVSGitHubConnectionService( */ @PostConstruct private void checks() { - if (this.GITHUB_AUTH_TOKEN.isEmpty()) { + if (this.GITHUB_AUTH_TOKEN.isEmpty() && StringUtils.isBlank(localPath)) { log.error( GITHUB_AUTH_TOKEN_ENV_VAR_NAME + "("