From 5f3fecc0420a69e8ab705e4aaf06f10c37001f10 Mon Sep 17 00:00:00 2001 From: shadrach Date: Tue, 29 Oct 2024 10:13:11 -0500 Subject: [PATCH 1/2] add role to metadata upload --- .env.example | 1 + desci-server/kubernetes/deployment_dev.yaml | 1 + desci-server/kubernetes/deployment_prod.yaml | 1 + desci-server/kubernetes/deployment_staging.yaml | 1 + desci-server/src/services/crossRef/client.ts | 2 +- desci-server/src/types/ProcessEnv.d.ts | 1 + 6 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index a47adff3b..874040d87 100755 --- a/.env.example +++ b/.env.example @@ -137,6 +137,7 @@ CROSSREF_METADATA_API=https://test.crossref.org/servlet/deposit CROSSREF_ADMIN_API=https://test.crossref.org CROSSREF_EMAIL= CROSSREF_LOGIN= +CROSSREF_LOGIN_ROLE= CROSSREF_PASSWORD= # Cross ref notification callback envs diff --git a/desci-server/kubernetes/deployment_dev.yaml b/desci-server/kubernetes/deployment_dev.yaml index 1703430a3..e0bf3a4ba 100644 --- a/desci-server/kubernetes/deployment_dev.yaml +++ b/desci-server/kubernetes/deployment_dev.yaml @@ -85,6 +85,7 @@ spec: export CROSSREF_EMAIL={{ .Data.CROSSREF_EMAIL }} export CROSSREF_DOI_URL={{ .Data.CROSSREF_DOI_URL }} export CROSSREF_LOGIN={{ .Data.CROSSREF_LOGIN }} + export CROSSREF_LOGIN_ROLE={{ .Data.CROSSREF_LOGIN_ROLE }} export CROSSREF_PASSWORD={{ .Data.CROSSREF_PASSWORD }} export CROSSREF_METADATA_API={{ .Data.CROSSREF_METADATA_API }} export CROSSREF_ADMIN_API={{ .Data.CROSSREF_ADMIN_API }} diff --git a/desci-server/kubernetes/deployment_prod.yaml b/desci-server/kubernetes/deployment_prod.yaml index 0cfe2e829..d736d1d6a 100755 --- a/desci-server/kubernetes/deployment_prod.yaml +++ b/desci-server/kubernetes/deployment_prod.yaml @@ -85,6 +85,7 @@ spec: export CROSSREF_EMAIL={{ .Data.CROSSREF_EMAIL }} export CROSSREF_DOI_URL={{ .Data.CROSSREF_DOI_URL }} export CROSSREF_LOGIN={{ .Data.CROSSREF_LOGIN }} + export CROSSREF_LOGIN_ROLE={{ .Data.CROSSREF_LOGIN_ROLE }} export CROSSREF_PASSWORD={{ .Data.CROSSREF_PASSWORD }} export CROSSREF_METADATA_API={{ .Data.CROSSREF_METADATA_API }} export CROSSREF_ADMIN_API={{ .Data.CROSSREF_ADMIN_API }} diff --git a/desci-server/kubernetes/deployment_staging.yaml b/desci-server/kubernetes/deployment_staging.yaml index d94eca4fc..140a52c67 100644 --- a/desci-server/kubernetes/deployment_staging.yaml +++ b/desci-server/kubernetes/deployment_staging.yaml @@ -97,6 +97,7 @@ spec: export CROSSREF_EMAIL={{ .Data.CROSSREF_EMAIL }} export CROSSREF_DOI_URL={{ .Data.CROSSREF_DOI_URL }} export CROSSREF_LOGIN={{ .Data.CROSSREF_LOGIN }} + export CROSSREF_LOGIN_ROLE={{ .Data.CROSSREF_LOGIN_ROLE }} export CROSSREF_PASSWORD={{ .Data.CROSSREF_PASSWORD }} export CROSSREF_METADATA_API={{ .Data.CROSSREF_METADATA_API }} export CROSSREF_ADMIN_API={{ .Data.CROSSREF_ADMIN_API }} diff --git a/desci-server/src/services/crossRef/client.ts b/desci-server/src/services/crossRef/client.ts index ebcc142ed..a0316fc93 100644 --- a/desci-server/src/services/crossRef/client.ts +++ b/desci-server/src/services/crossRef/client.ts @@ -227,7 +227,7 @@ class CrossRefClient { const metadata = Remixml.parse2txt(metadataTemplate, param); - const url = `${process.env.CROSSREF_METADATA_API}?operation=doMDUpload&login_id=${process.env.CROSSREF_LOGIN || 'dslb'}&login_passwd=${process.env.CROSSREF_PASSWORD || 'pgz6wze1fmg-RPN_qkv'}`; + const url = `${process.env.CROSSREF_METADATA_API}?operation=doMDUpload&login_id=${process.env.CROSSREF_LOGIN}/${process.env.CROSSREF_LOGIN_ROLE}&login_passwd=${process.env.CROSSREF_PASSWORD}`; logger.info({ param, metadata, url }, 'METADATA TO POST'); const buffer = Buffer.from(metadata, 'utf8'); diff --git a/desci-server/src/types/ProcessEnv.d.ts b/desci-server/src/types/ProcessEnv.d.ts index 35ac96f86..3a52bdec2 100755 --- a/desci-server/src/types/ProcessEnv.d.ts +++ b/desci-server/src/types/ProcessEnv.d.ts @@ -15,6 +15,7 @@ declare namespace NodeJS { CROSSREF_METADATA_API: string; ORCID_API_DOMAIN: string; CROSSREF_LOGIN: string; + CROSSREF_LOGIN_ROLE: string; CROSSREF_PASSWORD: string; CROSSREF_NOTIFY_ENDPOINT: string; CROSSREF_API_KEY: string; From 5b63caddac2f4045c43cd987a87e8302ca63ad37 Mon Sep 17 00:00:00 2001 From: shadrach Date: Tue, 29 Oct 2024 10:14:42 -0500 Subject: [PATCH 2/2] manually add role --- desci-server/kubernetes/deployment_dev.yaml | 1 - desci-server/kubernetes/deployment_prod.yaml | 1 - desci-server/kubernetes/deployment_staging.yaml | 1 - desci-server/src/services/crossRef/client.ts | 2 +- 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/desci-server/kubernetes/deployment_dev.yaml b/desci-server/kubernetes/deployment_dev.yaml index e0bf3a4ba..1703430a3 100644 --- a/desci-server/kubernetes/deployment_dev.yaml +++ b/desci-server/kubernetes/deployment_dev.yaml @@ -85,7 +85,6 @@ spec: export CROSSREF_EMAIL={{ .Data.CROSSREF_EMAIL }} export CROSSREF_DOI_URL={{ .Data.CROSSREF_DOI_URL }} export CROSSREF_LOGIN={{ .Data.CROSSREF_LOGIN }} - export CROSSREF_LOGIN_ROLE={{ .Data.CROSSREF_LOGIN_ROLE }} export CROSSREF_PASSWORD={{ .Data.CROSSREF_PASSWORD }} export CROSSREF_METADATA_API={{ .Data.CROSSREF_METADATA_API }} export CROSSREF_ADMIN_API={{ .Data.CROSSREF_ADMIN_API }} diff --git a/desci-server/kubernetes/deployment_prod.yaml b/desci-server/kubernetes/deployment_prod.yaml index d736d1d6a..0cfe2e829 100755 --- a/desci-server/kubernetes/deployment_prod.yaml +++ b/desci-server/kubernetes/deployment_prod.yaml @@ -85,7 +85,6 @@ spec: export CROSSREF_EMAIL={{ .Data.CROSSREF_EMAIL }} export CROSSREF_DOI_URL={{ .Data.CROSSREF_DOI_URL }} export CROSSREF_LOGIN={{ .Data.CROSSREF_LOGIN }} - export CROSSREF_LOGIN_ROLE={{ .Data.CROSSREF_LOGIN_ROLE }} export CROSSREF_PASSWORD={{ .Data.CROSSREF_PASSWORD }} export CROSSREF_METADATA_API={{ .Data.CROSSREF_METADATA_API }} export CROSSREF_ADMIN_API={{ .Data.CROSSREF_ADMIN_API }} diff --git a/desci-server/kubernetes/deployment_staging.yaml b/desci-server/kubernetes/deployment_staging.yaml index 140a52c67..d94eca4fc 100644 --- a/desci-server/kubernetes/deployment_staging.yaml +++ b/desci-server/kubernetes/deployment_staging.yaml @@ -97,7 +97,6 @@ spec: export CROSSREF_EMAIL={{ .Data.CROSSREF_EMAIL }} export CROSSREF_DOI_URL={{ .Data.CROSSREF_DOI_URL }} export CROSSREF_LOGIN={{ .Data.CROSSREF_LOGIN }} - export CROSSREF_LOGIN_ROLE={{ .Data.CROSSREF_LOGIN_ROLE }} export CROSSREF_PASSWORD={{ .Data.CROSSREF_PASSWORD }} export CROSSREF_METADATA_API={{ .Data.CROSSREF_METADATA_API }} export CROSSREF_ADMIN_API={{ .Data.CROSSREF_ADMIN_API }} diff --git a/desci-server/src/services/crossRef/client.ts b/desci-server/src/services/crossRef/client.ts index a0316fc93..85de49225 100644 --- a/desci-server/src/services/crossRef/client.ts +++ b/desci-server/src/services/crossRef/client.ts @@ -227,7 +227,7 @@ class CrossRefClient { const metadata = Remixml.parse2txt(metadataTemplate, param); - const url = `${process.env.CROSSREF_METADATA_API}?operation=doMDUpload&login_id=${process.env.CROSSREF_LOGIN}/${process.env.CROSSREF_LOGIN_ROLE}&login_passwd=${process.env.CROSSREF_PASSWORD}`; + const url = `${process.env.CROSSREF_METADATA_API}?operation=doMDUpload&login_id=${process.env.CROSSREF_LOGIN}/dslb&login_passwd=${process.env.CROSSREF_PASSWORD}`; logger.info({ param, metadata, url }, 'METADATA TO POST'); const buffer = Buffer.from(metadata, 'utf8');