From 0513812c963d1fe6dff9ba6ac444ac08d47e9c27 Mon Sep 17 00:00:00 2001 From: Julien Hagestedt Date: Sun, 2 May 2021 12:26:53 +0200 Subject: [PATCH] feat(#26): dgca-issuance-service upstream --- .grenrc.js | 30 ++++++++++++++++++++++++++++++ Dockerfile | 5 ++--- docker-compose.yml | 5 ++--- nginx/default.conf.template | 13 ++++--------- src/misc/edgcQRGenerator.tsx | 4 ++-- 5 files changed, 40 insertions(+), 17 deletions(-) create mode 100644 .grenrc.js diff --git a/.grenrc.js b/.grenrc.js new file mode 100644 index 0000000..e50821e --- /dev/null +++ b/.grenrc.js @@ -0,0 +1,30 @@ +module.exports = { + "dataSource": "prs", + "prefix": "", + "onlyMilestones": false, + "groupBy": { + "Enhancements": [ + "enhancement", + "internal" + ], + "Bug Fixes": [ + "bug" + ], + "Documentation": [ + "documentation" + ], + "Others": [ + "other" + ] + }, + "changelogFilename": "CHANGELOG.md", + "template": { + commit: ({ message, url, author, name }) => `- [${message}](${url}) - ${author ? `@${author}` : name}`, + issue: "- {{name}} [{{text}}]({{url}})", + noLabel: "other", + group: "\n#### {{heading}}\n", + changelogTitle: "# Changelog\n\n", + release: "## {{release}} ({{date}})\n{{body}}", + releaseSeparator: "\n---\n\n" + } +} diff --git a/Dockerfile b/Dockerfile index 338f2ed..cc09ec0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,5 @@ RUN yarn && yarn build FROM nginx:1.19.10 as app COPY --from=build ./app/build /usr/share/nginx/html COPY nginx/default.conf.template /etc/nginx/templates/default.conf.template -ENV DGCI_WEB_PORT=80 -ENV DGCI_SERVICE_HOST=localhost -ENV DGCI_SERVICE_PORT=8080 +ENV SERVER_PORT=80 +ENV DGCA_ISSUANCE_SERVICE_URL=http://localhost:8080 diff --git a/docker-compose.yml b/docker-compose.yml index 185d4f3..10e4d1b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,9 +9,8 @@ services: ports: - 8080:8080 environment: - - DGCI_WEB_PORT=8080 - - DGCI_SERVICE_HOST=dgc-issuance-service - - DGCI_SERVICE_PORT=8081 + - SERVER_PORT=8080 + - DGCA_ISSUANCE_SERVICE_URL=http://dgc-issuance-service:8081 networks: internal: diff --git a/nginx/default.conf.template b/nginx/default.conf.template index fbe0598..9e3aa07 100644 --- a/nginx/default.conf.template +++ b/nginx/default.conf.template @@ -1,9 +1,6 @@ -upstream service { - server ${DGCI_SERVICE_HOST}:${DGCI_SERVICE_PORT}; -} - server { - listen ${DGCI_WEB_PORT}; + listen ${SERVER_PORT}; + server_tokens off; location / { root /usr/share/nginx/html; index unresolvable-file-html.html; @@ -15,9 +12,7 @@ server { expires 0; try_files /index.html =404; } - location /service/ { - #proxy_set_header X-Forwarded-For $remote_addr; - #proxy_set_header Host $http_host; - proxy_pass http://service/; + location /dgca-issuance-service/ { + proxy_pass ${DGCA_ISSUANCE_SERVICE_URL}/; } } diff --git a/src/misc/edgcQRGenerator.tsx b/src/misc/edgcQRGenerator.tsx index ef61e01..f5bbe4a 100644 --- a/src/misc/edgcQRGenerator.tsx +++ b/src/misc/edgcQRGenerator.tsx @@ -55,7 +55,7 @@ interface SigResponse { const signerCall = (id: string, hash: string): Promise => { - return api.put('/service/dgci/' + id, { hash: hash }) + return api.put('/dgca-issuance-service/dgci/' + id, { hash: hash }) .then(res => { const sigResponse: SigResponse = res.data; return sigResponse; @@ -71,7 +71,7 @@ const generateQRCode = (edgcPayload: EUDGC): Promise => { let tan: string = ''; - return api.post('/service/dgci', certInit) + return api.post('/dgca-issuance-service/dgci', certInit) .then(response => { const certMetaData: CertificateMetaData = response.data; // TODO copy dgci to EUDGC