From fd235f63db1b232f095296a55bf5a514454acb44 Mon Sep 17 00:00:00 2001
From: jerrypan <Jerrypan44@gmail.com>
Date: Thu, 24 Oct 2019 03:00:13 -0700
Subject: [PATCH] merging with cleanup

---
 build.sh                                             |  4 ++--
 docker/config/application.tmpl                       |  1 +
 .../java/eu/hbp/mip/controllers/RequestsApi.java     | 12 ++++++++----
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/build.sh b/build.sh
index 3ac678400..48250ac9f 100755
--- a/build.sh
+++ b/build.sh
@@ -35,10 +35,10 @@ docker build --build-arg BUILD_DATE=$(date -Iseconds) \
     --build-arg VERSION=$VERSION \
     --tag "$IMAGE:latest" \
     --tag "$IMAGE:$VERSION" \
-    --tag kkech/portal_backend:latest \
+    --tag jerrypan44/portal_backend:latest \
     .
 
-docker push kkech/portal_backend:latest
+docker push jerrypan44/portal_backend:latest
 
 BUGSNAG_KEY=""
 eval $(grep -e "^\\s*BUGSNAG_KEY" Dockerfile | tr '\\' ' ')
diff --git a/docker/config/application.tmpl b/docker/config/application.tmpl
index 4651cb58d..b3fb351fe 100644
--- a/docker/config/application.tmpl
+++ b/docker/config/application.tmpl
@@ -92,6 +92,7 @@ services:
     algorithmsUrl: {{ default .Env.EXAREME_URL "http://localhost:9090" }}/mining/algorithms.json
   workflows:
     workflowUrl: {{ default .Env.WORKFLOW_URL "http://localhost:9090" }}
+    jwtSecret: {{ default .Env.JWT_SECRET "secret" }}
     workflowAuthorization: {{ default .Env.WORKFLOW_AUTHORIZATION "undefined" }}
   galaxy:
     galaxyUsername:  {{ default .Env.GALAXY_USERNAME admin }}
diff --git a/src/main/java/eu/hbp/mip/controllers/RequestsApi.java b/src/main/java/eu/hbp/mip/controllers/RequestsApi.java
index 84a869730..3a06a26fe 100644
--- a/src/main/java/eu/hbp/mip/controllers/RequestsApi.java
+++ b/src/main/java/eu/hbp/mip/controllers/RequestsApi.java
@@ -17,6 +17,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
@@ -121,6 +122,12 @@ public class RequestsApi {
         return prefix + memId;
     }
 
+    @Value("#{'${services.galaxy.galaxyUsername:admin}'}")
+    private boolean galaxyUsername;
+
+    @Value("#{'${services.galaxy.galaxyPassword:admin}'}")
+    private boolean galaxyPassword;
+
     /**
      * Get Galaxy Reverse Proxy basic access token.
      *
@@ -129,10 +136,7 @@ public class RequestsApi {
     @RequestMapping(method = RequestMethod.GET, produces = "application/json")
     @ResponseStatus(value = HttpStatus.OK)
     public ResponseEntity getGalaxyBasicAccessToken(){
-        String username = "admin";
-        String password = "admin";
-
-        String stringEncoded = Base64.getEncoder().encodeToString((username + ":" + password).getBytes());
+        String stringEncoded = Base64.getEncoder().encodeToString((galaxyUsername + ":" + galaxyPassword).getBytes());
         return ResponseEntity.ok(new StringDtoResponse(stringEncoded));
     }
 
-- 
GitLab