This is an automated email from the ASF dual-hosted git repository.

marat pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-karavan.git


The following commit(s) were added to refs/heads/main by this push:
     new 26553525 Improve Git configuration error handling in GitService (#1530)
26553525 is described below

commit 2655352589ce8d72aa152844bbe4d0a40f2cfe9f
Author: Artur Gubaidullin <artur.gubaidul...@gmail.com>
AuthorDate: Fri May 30 10:09:05 2025 -0400

    Improve Git configuration error handling in GitService (#1530)
---
 .../apache/camel/karavan/service/GitService.java   | 23 +++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git 
a/karavan-app/src/main/java/org/apache/camel/karavan/service/GitService.java 
b/karavan-app/src/main/java/org/apache/camel/karavan/service/GitService.java
index 29272411..1ce9f35e 100644
--- a/karavan-app/src/main/java/org/apache/camel/karavan/service/GitService.java
+++ b/karavan-app/src/main/java/org/apache/camel/karavan/service/GitService.java
@@ -100,14 +100,23 @@ public class GitService {
     }
 
     public GitConfig getGitConfig() {
-        if (ephemeral) {
-            repository = "http://karavan.git";;
-            username = Optional.of("karavan");
-            password = Optional.of("karavan");
-            privateKeyPath = Optional.empty();
-            knownHostsPath = Optional.empty();
+        try {
+            if (ephemeral) {
+                repository = "http://karavan.git";;
+                username = Optional.of("karavan");
+                password = Optional.of("karavan");
+                privateKeyPath = Optional.empty();
+                knownHostsPath = Optional.empty();
+            }
+            if (repository == null || repository.isBlank()) {
+                LOGGER.error("Git repository configuration 
'karavan.git.repository' is missing or empty. Please set it in your application 
properties.");
+                throw new IllegalStateException("Missing required 
configuration: karavan.git.repository");
+            }
+            return new GitConfig(repository, username.orElse(null), 
password.orElse(null), branch, privateKeyPath.orElse(null));
+        } catch (Exception e) {
+            LOGGER.error("Failed to load Git configuration: " + 
e.getMessage(), e);
+            throw e;
         }
-        return new GitConfig(repository, username.orElse(null), 
password.orElse(null), branch, privateKeyPath.orElse(null));
     }
 
     public Tuple2<String,String> getSShFiles() {

Reply via email to