From 56e296235bc45be57d765830d02f67aa3b3de6bd Mon Sep 17 00:00:00 2001
From: Martin Weise <martin.weise@tuwien.ac.at>
Date: Wed, 15 Dec 2021 15:45:11 +0100
Subject: [PATCH] Remove zenodo

Former-commit-id: 2d0541ec36201daab8c47f8111eb05906d89c496
---
 .env.example                                  |  5 ++-
 .fda-deployment/docker-compose.yml            |  1 -
 .gitlab-ci.yml                                |  2 +-
 Makefile                                      | 16 +++----
 docker-compose.yml                            |  1 -
 .../src/main/resources/application-docker.yml |  5 +--
 .../src/main/resources/application.yml        |  5 +--
 .../src/test/resources/application.properties |  4 +-
 .../java/at/tuwien/config/ZenodoConfig.java   | 43 -------------------
 .../src/test/resources/application.properties |  4 +-
 10 files changed, 15 insertions(+), 71 deletions(-)
 delete mode 100644 fda-citation-service/services/src/main/java/at/tuwien/config/ZenodoConfig.java

diff --git a/.env.example b/.env.example
index 26ae9e5171..d2c96e2a56 100644
--- a/.env.example
+++ b/.env.example
@@ -1,2 +1,3 @@
-ZENODO_API_KEY=
-API=http://fda-gateway-service:9095
+REGISTRY="docker.example.com"
+API="http://fda-gateway-service:9095"
+KEY_STORE_PASSWORD="12345"
diff --git a/.fda-deployment/docker-compose.yml b/.fda-deployment/docker-compose.yml
index 6996905172..4b5dffb74f 100644
--- a/.fda-deployment/docker-compose.yml
+++ b/.fda-deployment/docker-compose.yml
@@ -232,7 +232,6 @@ services:
       - fda-public
     environment:
       SPRING_PROFILES_ACTIVE: docker
-      ZENODO_API_KEY: "${ZENODO_API_KEY}"
     ports:
       - "9096:9096"
     depends_on:
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3f0b300315..e1d57843e9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -246,7 +246,7 @@ test-backend-citation:
   dependencies:
     - build-backend-citation
   script:
-    - "ZENODO_API_KEY=${ZENODO_API_KEY} mvn -f fda-citation-service/pom.xml clean test verify"
+    - mvn -f fda-citation-service/pom.xml clean test verify
     - cat ./fda-citation-service/report/target/site/jacoco-aggregate/index.html
   artifacts:
     when: always
diff --git a/Makefile b/Makefile
index 6cc81347fd..3536e5895f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,13 @@
-REGISTRY=docker.ossdip.at
-
 all:
 
 config-backend:
-	./.rhel-prod/fda-authentication-service/install_cert
+	./.fda-deployment/fda-authentication-service/install_cert
 
 config-registry:
-	./.rhel-registry/install_cert
+	./.fda-builder/registry/install_cert
 
 config-frontend:
-	./.rhel-prod/fda-ui/install_cert
+	./.fda-deployment/fda-ui/install_cert
 	docker-compose -f docker-compose.prod.yml config
 
 config-docker:
@@ -58,8 +56,8 @@ build-docker-sandbox:
 	docker-compose -f docker-compose.prod.yml build
 
 build-frontend:
-	yarn --cwd ./fda-ui install --legacy-peer-deps
-	yarn --cwd ./fda-ui run build
+	API="${GATEWAY}" yarn --cwd ./fda-ui install --legacy-peer-deps
+	API="${GATEWAY}" yarn --cwd ./fda-ui run build
 
 build: clean build-backend build-frontend build-docker
 
@@ -95,9 +93,9 @@ coverage-frontend: clean build-frontend
 	yarn --cwd ./fda-ui run coverage || true
 
 test-frontend: clean build-frontend
-	yarn --cwd ./fda-ui install
+	API="${GATEWAY}" yarn --cwd ./fda-ui install
 	docker-compose up -d
-	yarn --cwd ./fda-ui run test
+	API="${GATEWAY}" yarn --cwd ./fda-ui run test
 
 test: test-backend test-frontend
 
diff --git a/docker-compose.yml b/docker-compose.yml
index e2bef6390d..07fcbb3883 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -234,7 +234,6 @@ services:
 #      - fda-public
 #    environment:
 #      SPRING_PROFILES_ACTIVE: docker
-#      ZENODO_API_KEY: "${ZENODO_API_KEY}"
 #      TZ: Europe/Vienna
 #    ports:
 #      - "9096:9096"
diff --git a/fda-citation-service/rest-service/src/main/resources/application-docker.yml b/fda-citation-service/rest-service/src/main/resources/application-docker.yml
index 468fe81b49..3032485c70 100644
--- a/fda-citation-service/rest-service/src/main/resources/application-docker.yml
+++ b/fda-citation-service/rest-service/src/main/resources/application-docker.yml
@@ -28,7 +28,4 @@ fda:
   ready.path: /ready
   mapping.path: /root
   table.path: /root
-  query.endpoint: fda-table-service:9093
-zenodo:
-  endpoint: https://sandbox.zenodo.org/
-  api_key: "${ZENODO_API_KEY}"
\ No newline at end of file
+  query.endpoint: fda-table-service:9093
\ No newline at end of file
diff --git a/fda-citation-service/rest-service/src/main/resources/application.yml b/fda-citation-service/rest-service/src/main/resources/application.yml
index 37ac6c912d..83f56409bd 100644
--- a/fda-citation-service/rest-service/src/main/resources/application.yml
+++ b/fda-citation-service/rest-service/src/main/resources/application.yml
@@ -28,7 +28,4 @@ fda:
   ready.path: ~/
   mapping.path: rest-service/src/main/resources
   table.path: rest-service/src/main/java/at/tuwien/userdb
-  query.endpoint: fda-query-service:9093
-zenodo:
-  endpoint: https://sandbox.zenodo.org/
-  api_key: "${ZENODO_API_KEY}"
\ No newline at end of file
+  query.endpoint: fda-query-service:9093
\ No newline at end of file
diff --git a/fda-citation-service/rest-service/src/test/resources/application.properties b/fda-citation-service/rest-service/src/test/resources/application.properties
index 5002d6fb8f..1226b46442 100644
--- a/fda-citation-service/rest-service/src/test/resources/application.properties
+++ b/fda-citation-service/rest-service/src/test/resources/application.properties
@@ -15,6 +15,4 @@ spring.jpa.hibernate.ddl-auto=create-drop
 spring.jpa.show-sql=false
 
 fda.mapping.path: /tmp
-fda.table.path: /tmp
-
-zenodo.endpoint: https://sandbox.zenodo.org/
\ No newline at end of file
+fda.table.path: /tmp
\ No newline at end of file
diff --git a/fda-citation-service/services/src/main/java/at/tuwien/config/ZenodoConfig.java b/fda-citation-service/services/src/main/java/at/tuwien/config/ZenodoConfig.java
deleted file mode 100644
index 25647383e9..0000000000
--- a/fda-citation-service/services/src/main/java/at/tuwien/config/ZenodoConfig.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package at.tuwien.config;
-
-import at.tuwien.exception.RemoteAuthenticationException;
-import lombok.Getter;
-import lombok.extern.log4j.Log4j2;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.web.client.RestTemplateBuilder;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.client.RestTemplate;
-import org.springframework.web.util.DefaultUriBuilderFactory;
-
-import javax.validation.constraints.NotNull;
-
-@Log4j2
-@Configuration
-public class ZenodoConfig {
-
-    @Getter
-    @NotNull
-    @Value("${zenodo.endpoint}")
-    private String zenodoEndpoint;
-
-    @NotNull
-    @Value("${zenodo.api_key}")
-    private String apiKey;
-
-    public String getApiKey() throws RemoteAuthenticationException {
-        if (apiKey == null || apiKey.isEmpty()) {
-            log.debug("api key is {}", apiKey);
-            throw new RemoteAuthenticationException("Did not find a valid Zenodo API key in environment variable ZENODO_API_KEY");
-        }
-        return apiKey;
-    }
-
-    @Bean
-    public RestTemplate zenodoTemplate() {
-        return new RestTemplateBuilder()
-                .uriTemplateHandler(new DefaultUriBuilderFactory(zenodoEndpoint))
-                .build();
-    }
-
-}
diff --git a/fda-table-service/rest-service/src/test/resources/application.properties b/fda-table-service/rest-service/src/test/resources/application.properties
index 37d0065cbf..05fbac4c44 100644
--- a/fda-table-service/rest-service/src/test/resources/application.properties
+++ b/fda-table-service/rest-service/src/test/resources/application.properties
@@ -23,6 +23,4 @@ logging.level.at.tuwien.=trace
 spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration,org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchRepositoriesAutoConfiguration,org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration
 
 fda.mapping.path: /tmp
-fda.table.path: /tmp
-
-zenodo.endpoint: https://sandbox.zenodo.org/
\ No newline at end of file
+fda.table.path: /tmp
\ No newline at end of file
-- 
GitLab