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 795d4d1 Fix Git secret prefix for Kubernetes (#465)
795d4d1 is described below
commit 795d4d1aa1ba1ebea737dddf3038abfe759c2ff8
Author: Marat Gubaidullin <[email protected]>
AuthorDate: Fri Aug 19 17:03:55 2022 -0400
Fix Git secret prefix for Kubernetes (#465)
---
.../apache/camel/karavan/service/GitService.java | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 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 8a5dbf4..e2e1490 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
@@ -73,21 +73,22 @@ public class GitService {
}
private GitConfig getGitConfig(String name) {
- String prefix = "karavan." + name + "-";
- String mainBranch = ConfigProvider.getConfig().getValue(prefix +
"git-main", String.class);
+ String propertiesPrefix = "karavan." + name + "-";
+ String mainBranch =
ConfigProvider.getConfig().getValue(propertiesPrefix + "git-main",
String.class);
if (kubernetesService.inKubernetes()){
+ String kubernetesPrefix = name + "-";
Secret secret = kubernetesService.getKaravanSecret();
- String uri = new
String(Base64.getDecoder().decode(secret.getData().get(prefix +
"git-repository").getBytes(StandardCharsets.UTF_8)));
- String username = new
String(Base64.getDecoder().decode(secret.getData().get(prefix +
"git-username").getBytes(StandardCharsets.UTF_8)));
- String password = new
String(Base64.getDecoder().decode(secret.getData().get(prefix +
"git-password").getBytes(StandardCharsets.UTF_8)));
- if (secret.getData().containsKey(prefix + "git-main")){
- mainBranch = new
String(Base64.getDecoder().decode(secret.getData().get(prefix +
"git-main").getBytes(StandardCharsets.UTF_8)));
+ String uri = new
String(Base64.getDecoder().decode(secret.getData().get(kubernetesPrefix +
"git-repository").getBytes(StandardCharsets.UTF_8)));
+ String username = new
String(Base64.getDecoder().decode(secret.getData().get(kubernetesPrefix +
"git-username").getBytes(StandardCharsets.UTF_8)));
+ String password = new
String(Base64.getDecoder().decode(secret.getData().get(kubernetesPrefix +
"git-password").getBytes(StandardCharsets.UTF_8)));
+ if (secret.getData().containsKey(kubernetesPrefix + "git-main")){
+ mainBranch = new
String(Base64.getDecoder().decode(secret.getData().get(kubernetesPrefix +
"git-main").getBytes(StandardCharsets.UTF_8)));
}
return new GitConfig(uri, username, password, mainBranch);
} else {
- String uri = ConfigProvider.getConfig().getValue(prefix +
"git-repository", String.class);
- String username = ConfigProvider.getConfig().getValue(prefix +
"git-username", String.class);
- String password = ConfigProvider.getConfig().getValue(prefix +
"git-password", String.class);
+ String uri = ConfigProvider.getConfig().getValue(propertiesPrefix
+ "git-repository", String.class);
+ String username =
ConfigProvider.getConfig().getValue(propertiesPrefix + "git-username",
String.class);
+ String password =
ConfigProvider.getConfig().getValue(propertiesPrefix + "git-password",
String.class);
return new GitConfig(uri, username, password, mainBranch);
}
}