diff --git a/.github/workflows/backend-tests.yml b/.github/workflows/backend-tests.yml index cb126e81b..7bed880bf 100644 --- a/.github/workflows/backend-tests.yml +++ b/.github/workflows/backend-tests.yml @@ -17,8 +17,8 @@ jobs: timeout-minutes: 15 env: CROSSREF_USERNAME: ${{ secrets.CROSSREF_USERNAME }} - CROSSREF_TEST_PASSWORD: ${{ secrets.CROSSREF_TEST_PASSWORD }} - CROSSREF_TEST_ENDPOINT: ${{ secrets.CROSSREF_TEST_ENDPOINT }} + CROSSREF_PASSWORD: ${{ secrets.CROSSREF_PASSWORD }} + CROSSREF_ENDPOINT: ${{ secrets.CROSSREF_ENDPOINT }} CROSSREF_DOI_PREFIX: ${{ secrets.CROSSREF_DOI_PREFIX }} steps: - name: Login to Docker Hub diff --git a/backend/src/main/kotlin/org/loculus/backend/api/SeqSetCitations.kt b/backend/src/main/kotlin/org/loculus/backend/api/SeqSetCitations.kt index d7ae4e55f..84b0ce97f 100644 --- a/backend/src/main/kotlin/org/loculus/backend/api/SeqSetCitations.kt +++ b/backend/src/main/kotlin/org/loculus/backend/api/SeqSetCitations.kt @@ -83,6 +83,5 @@ data class AuthorProfile( ) object SeqSetCitationsConstants { - const val DOI_PREFIX = "placeholder" const val DOI_WEEKLY_RATE_LIMIT = 7 } diff --git a/backend/src/main/kotlin/org/loculus/backend/service/crossref/CrossRefService.kt b/backend/src/main/kotlin/org/loculus/backend/service/crossref/CrossRefService.kt index b6461a9e7..c825d02e2 100644 --- a/backend/src/main/kotlin/org/loculus/backend/service/crossref/CrossRefService.kt +++ b/backend/src/main/kotlin/org/loculus/backend/service/crossref/CrossRefService.kt @@ -20,13 +20,19 @@ import java.util.UUID private val log = KotlinLogging.logger { } @ConfigurationProperties(prefix = "crossref") -data class CrossRefServiceProperties(val endpoint: String?, val username: String?, val password: String?) +data class CrossRefServiceProperties( + val endpoint: String?, + val username: String?, + val password: String?, + val doiPrefix: String?, +) @Service class CrossRefService(private val crossRefServiceProperties: CrossRefServiceProperties) { val isActive = crossRefServiceProperties.endpoint != null && crossRefServiceProperties.username != null && - crossRefServiceProperties.password != null + crossRefServiceProperties.password != null && + crossRefServiceProperties.doiPrefix != null val dateTimeFormatterMM = DateTimeFormatter.ofPattern("MM") val dateTimeFormatterdd = DateTimeFormatter.ofPattern("dd") val dateTimeFormatteryyyy = DateTimeFormatter.ofPattern("yyyy") diff --git a/backend/src/main/kotlin/org/loculus/backend/service/seqsetcitations/SeqSetCitationsDatabaseService.kt b/backend/src/main/kotlin/org/loculus/backend/service/seqsetcitations/SeqSetCitationsDatabaseService.kt index 6c609c991..753a451a5 100644 --- a/backend/src/main/kotlin/org/loculus/backend/service/seqsetcitations/SeqSetCitationsDatabaseService.kt +++ b/backend/src/main/kotlin/org/loculus/backend/service/seqsetcitations/SeqSetCitationsDatabaseService.kt @@ -32,6 +32,7 @@ import org.loculus.backend.auth.AuthenticatedUser import org.loculus.backend.config.BackendConfig import org.loculus.backend.controller.NotFoundException import org.loculus.backend.controller.UnprocessableEntityException +import org.loculus.backend.service.crossref.CrossRefServiceProperties import org.loculus.backend.service.submission.AccessionPreconditionValidator import org.loculus.backend.utils.getNextSequenceNumber import org.springframework.stereotype.Service @@ -47,6 +48,7 @@ private val log = KotlinLogging.logger { } class SeqSetCitationsDatabaseService( private val accessionPreconditionValidator: AccessionPreconditionValidator, private val backendConfig: BackendConfig, + private val crossRefServiceProperties: CrossRefServiceProperties, pool: DataSource, ) { init { @@ -333,7 +335,8 @@ class SeqSetCitationsDatabaseService( validateCreateSeqSetDOI(username, seqSetId, version) - val seqSetDOI = "${SeqSetCitationsConstants.DOI_PREFIX}/$seqSetId.$version" + val doiPrefix = crossRefServiceProperties.doiPrefix ?: "no-prefix-configured" + val seqSetDOI = "$doiPrefix/$seqSetId.$version" SeqSetsTable.update( { diff --git a/backend/src/test/resources/application.properties b/backend/src/test/resources/application.properties index 77e5aafde..23580ef78 100644 --- a/backend/src/test/resources/application.properties +++ b/backend/src/test/resources/application.properties @@ -4,6 +4,7 @@ loculus.config.path=src/test/resources/backend_config.json crossref.endpoint=dummy crossref.username=dummy crossref.password=dummy +crossref.doi-prefix=placeholder keycloak.user=dummy keycloak.password=dummy diff --git a/kubernetes/loculus/templates/loculus-backend.yaml b/kubernetes/loculus/templates/loculus-backend.yaml index 7ce71aa50..14692406c 100644 --- a/kubernetes/loculus/templates/loculus-backend.yaml +++ b/kubernetes/loculus/templates/loculus-backend.yaml @@ -46,9 +46,9 @@ spec: - containerPort: 8079 args: - "--crossref.doi-prefix=$(CROSSREF_DOI_PREFIX)" - - "--crossref.endpoint=$(CROSSREF_TEST_ENDPOINT)" + - "--crossref.endpoint=$(CROSSREF_ENDPOINT)" - "--crossref.username=$(CROSSREF_USERNAME)" - - "--crossref.password=$(CROSSREF_TEST_PASSWORD)" + - "--crossref.password=$(CROSSREF_PASSWORD)" - "--keycloak.password=$(BACKEND_KEYCLOAK_PASSWORD)" - "--keycloak.realm=loculus" - "--keycloak.client=backend-client" @@ -71,16 +71,15 @@ spec: secretKeyRef: name: crossref key: username - - name: CROSSREF_TEST_PASSWORD + - name: CROSSREF_PASSWORD valueFrom: secretKeyRef: name: crossref - key: testPassword - - name: CROSSREF_LIVE_PASSWORD - valueFrom: - secretKeyRef: - name: crossref - key: livePassword + key: password + - name: CROSSREF_DOI_PREFIX + value: {{$.Values.crossRef.DOIPrefix | quote }} + - name: CROSSREF_ENDPOINT + value: {{$.Values.crossRef.endpoint | quote }} {{- end }} - name: BACKEND_KEYCLOAK_PASSWORD valueFrom: diff --git a/kubernetes/loculus/values.yaml b/kubernetes/loculus/values.yaml index fde9161af..6f5707733 100644 --- a/kubernetes/loculus/values.yaml +++ b/kubernetes/loculus/values.yaml @@ -1,8 +1,7 @@ environment: server crossRef: DOIPrefix: "10.62599" - testEndpoint: "https://test.crossref.org" - liveEndpoint: "https://doi.crossref.org" + endpoint: "https://test.crossref.org" disableWebsite: false disableBackend: false disablePreprocessing: false @@ -1482,8 +1481,7 @@ secrets: type: raw data: username: "dummy" - testPassword: "dummy" - livePassword: "dummy" + password: "dummy" service-accounts: type: autogen data: