Skip to content

Commit

Permalink
add dpid env var for pdf cover generations
Browse files Browse the repository at this point in the history
  • Loading branch information
kadamidev committed Jul 16, 2024
1 parent 713f34b commit 18dd187
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion desci-media-isolated/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ NODE_ENV=development

PORT=7771

IPFS_GATEWAY=http://host.docker.internal:5420/v1/ipfs
IPFS_GATEWAY=http://host.docker.internal:5420/v1/ipfs

DPID_RESOLVER_URL=https://dev-beta.dpid.org
2 changes: 2 additions & 0 deletions desci-media-isolated/kubernetes/deployment_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ spec:
value: '7771'
- name: IPFS_GATEWAY
value: 'https://ipfs.desci.com/ipfs'
- name: DPID_RESOLVER_URL
value: 'https://dev-beta.dpid.org'
resources:
limits:
cpu: '4'
Expand Down
2 changes: 2 additions & 0 deletions desci-media-isolated/kubernetes/deployment_prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ spec:
value: '7771'
- name: IPFS_GATEWAY
value: 'http://host.docker.internal:5420/v1/ipfs'
- name: DPID_RESOLVER_URL
value: 'https://beta.dpid.org'
resources:
limits:
cpu: '0.5'
Expand Down
2 changes: 2 additions & 0 deletions desci-media-isolated/kubernetes/deployment_staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ spec:
value: '7771'
- name: IPFS_GATEWAY
value: 'http://host.docker.internal:5420/v1/ipfs'
- name: DPID_RESOLVER_URL
value: 'https://dev-beta.dpid.org'
resources:
limits:
cpu: '0.5'
Expand Down
4 changes: 3 additions & 1 deletion desci-media-isolated/src/services/pdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ export class PdfManipulationService {
/*
* Header
*/
const dpidResolverUrl = process.env.DPID_RESOLVER_URL ?? 'https://beta.dpid.org';

const licenseStartsWithVowel = startsWithVowel(license);
const nodeUrl = usingDoi ? `https://doi.org/${doi}` : `https://beta.dpid.org/${dpid}`;
const nodeUrl = usingDoi ? `https://doi.org/${doi}` : `${dpidResolverUrl}/${dpid}`;
const topHeader = `Research object ${nodeUrl}, this version posted ${publishDate}. The copyright holder for this research object (which was not certified by peer review) is the author/funder, who has granted DeSci Labs a non-exclsuive license to display the research object in perpetuity. It is made available under a${
licenseStartsWithVowel ? 'n' : ''
} ${license} license.`;
Expand Down
5 changes: 3 additions & 2 deletions desci-server/src/services/PublishPackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,13 @@ class PublishPackageService {
const openCodeAttestation = attestations.find((a) => a.attestationVersion.name === 'Open Code');
const openDataAttestation = attestations.find((a) => a.attestationVersion.name === 'Open Data');

const dpidUrl = process.env.DPID_URL_OVERRIDE ?? 'https://beta.dpid.org';
const attestationLinks = {
...(openCodeAttestation && {
codeAvailableDpid: `https://beta.dpid.org/${dpid}/attestations/${toKebabCase(openCodeAttestation.attestationVersion.name)}`,
codeAvailableDpid: `${dpidUrl}/${dpid}/attestations/${toKebabCase(openCodeAttestation.attestationVersion.name)}`,
}),
...(openDataAttestation && {
dataAvailableDpid: `https://beta.dpid.org/${dpid}/attestations/${toKebabCase(openDataAttestation.attestationVersion.name)}`,
dataAvailableDpid: `${dpidUrl}/${dpid}/attestations/${toKebabCase(openDataAttestation.attestationVersion.name)}`,
}),
};

Expand Down

0 comments on commit 18dd187

Please sign in to comment.