Skip to content

Commit 2e2abbb

Browse files
committed
Merge branch 'feature/merge-files' into feature/merge-files-spinner
2 parents c57cb02 + 5675c66 commit 2e2abbb

File tree

9 files changed

+16
-5
lines changed

9 files changed

+16
-5
lines changed

.nais/fyllut/config.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ spec:
8989
value: {{skjemabygging-proxy-client-id}}
9090
- name: GOTENBERG_URL
9191
value: {{gotenberg-url}}
92+
- name: GOTENBERG_URL_EN
93+
value: {{gotenberg-url-en}}
9294
- name: SEND_INN_TOKEN_X_CLIENT_ID
9395
value: {{send-inn-token-x-client-id}}
9496
- name: SEND_INN_HOST

.nais/fyllut/dev-delingslenke.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ dekorator-url: https://www.nav.no/dekoratoren?simple=true
99
skjemabygging-proxy-client-id: 95170319-b4d7-4190-8271-118ed19bafbf
1010
skjemabygging-proxy-url: https://skjemabygging-proxy.dev-fss-pub.nais.io
1111
gotenberg-url: http://upload-convert-to-pdf.fyllut-sendinn
12+
gotenberg-url-en: http://upload-convert-to-pdf-en.fyllut-sendinn
1213
send-inn-token-x-client-id: dev-gcp:team-soknad:innsending-api
1314
send-inn-host: http://innsending-api.team-soknad
1415
forms-api-url: https://forms-api.nav.no

.nais/fyllut/dev.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ dekorator-url: https://www.nav.no/dekoratoren?simple=true
1010
skjemabygging-proxy-client-id: 95170319-b4d7-4190-8271-118ed19bafbf
1111
skjemabygging-proxy-url: https://skjemabygging-proxy.dev-fss-pub.nais.io
1212
gotenberg-url: http://upload-convert-to-pdf.fyllut-sendinn
13+
gotenberg-url-en: http://upload-convert-to-pdf-en.fyllut-sendinn
1314
send-inn-token-x-client-id: dev-gcp:team-soknad:innsending-api
1415
send-inn-host: http://innsending-api.team-soknad
1516
kodeverk:

.nais/fyllut/preprod-alt.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ dekorator-url: https://www.nav.no/dekoratoren?simple=true
1010
skjemabygging-proxy-client-id: 95170319-b4d7-4190-8271-118ed19bafbf
1111
skjemabygging-proxy-url: https://skjemabygging-proxy.dev-fss-pub.nais.io
1212
gotenberg-url: http://upload-convert-to-pdf.fyllut-sendinn
13+
gotenberg-url-en: http://upload-convert-to-pdf-en.fyllut-sendinn
1314
send-inn-token-x-client-id: dev-gcp:team-soknad:innsending-api
1415
send-inn-host: http://innsending-api.team-soknad
1516
kodeverk:

.nais/fyllut/preprod.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ dekorator-url: https://www.nav.no/dekoratoren?simple=true
1010
skjemabygging-proxy-client-id: 95170319-b4d7-4190-8271-118ed19bafbf
1111
skjemabygging-proxy-url: https://skjemabygging-proxy.dev-fss-pub.nais.io
1212
gotenberg-url: http://upload-convert-to-pdf.fyllut-sendinn
13+
gotenberg-url-en: http://upload-convert-to-pdf-en.fyllut-sendinn
1314
send-inn-token-x-client-id: dev-gcp:team-soknad:innsending-api
1415
send-inn-host: http://innsending-api.team-soknad
1516
kodeverk:

.nais/fyllut/prod.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ dekorator-url: https://www.nav.no/dekoratoren?simple=true
99
skjemabygging-proxy-client-id: 031863f2-9881-44af-ace5-6b5ab52afeb1
1010
skjemabygging-proxy-url: https://skjemabygging-proxy.prod-fss-pub.nais.io
1111
gotenberg-url: http://upload-convert-to-pdf.fyllut-sendinn
12+
gotenberg-url-en: http://upload-convert-to-pdf-en.fyllut-sendinn
1213
send-inn-token-x-client-id: prod-gcp:team-soknad:innsending-api
1314
send-inn-host: http://innsending-api.team-soknad
1415
kodeverk:

packages/fyllut-backend/src/config/config.ts

+2
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ const localDevelopmentConfig: DefaultConfig = {
6767
decoratorUrl: 'https://www.nav.no/dekoratoren?simple=true',
6868
skjemabyggingProxyUrl: process.env.SKJEMABYGGING_PROXY_URL || 'https://skjemabygging-proxy.dev-fss-pub.nais.io',
6969
gotenbergUrl: process.env.GOTENBERG_URL || 'https://convert-to-pdf.intern.dev.nav.no',
70+
gotenbergUrlEn: process.env.GOTENBERG_URL_EN || 'https://convert-to-pdf-en.intern.dev.nav.no',
7071
skjemabyggingProxyClientId: '95170319-b4d7-4190-8271-118ed19bafbf',
7172
azureOpenidTokenEndpoint:
7273
process.env.AZURE_OPENID_CONFIG_TOKEN_ENDPOINT ||
@@ -115,6 +116,7 @@ const defaultConfig: DefaultConfig = {
115116
skjemabyggingProxyUrl: process.env.SKJEMABYGGING_PROXY_URL!,
116117
skjemabyggingProxyClientId: process.env.SKJEMABYGGING_PROXY_CLIENT_ID!,
117118
gotenbergUrl: process.env.GOTENBERG_URL!,
119+
gotenbergUrlEn: process.env.GOTENBERG_URL_EN!,
118120
azureOpenidTokenEndpoint: process.env.AZURE_OPENID_CONFIG_TOKEN_ENDPOINT!,
119121
clientId: process.env.AZURE_APP_CLIENT_ID!,
120122
skjemaDir: process.env.SKJEMA_DIR!,

packages/fyllut-backend/src/config/types.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export type DefaultConfig = {
4040
skjemabyggingProxyUrl: string;
4141
skjemabyggingProxyClientId: string;
4242
gotenbergUrl: string;
43+
gotenbergUrlEn: string;
4344
azureOpenidTokenEndpoint: string;
4445
clientId: string;
4546
skjemaDir?: string;

packages/fyllut-backend/src/services/documents/gotenbergService.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { logger } from '../../logger';
55
import { synchronousResponseToError } from '../../utils/errorHandling';
66
import fetchWithRetry from '../../utils/fetchWithRetry';
77

8-
const { gotenbergUrl } = config;
8+
const { gotenbergUrl, gotenbergUrlEn } = config;
99

1010
// Sette opp formdata til å merge en liste av PDFer
1111
export const mergeFiles = async (
@@ -42,20 +42,21 @@ export const mergeFiles = async (
4242

4343
// Hvordan sette språk? En engelsk og en norsk Gotenberg installasjon?
4444
logger.info(`Skal kalle Gotenberg for å merge filer`);
45-
return await callGotenberg('/forms/pdfengines/merge', formData);
45+
return await callGotenberg(language, '/forms/pdfengines/merge', formData);
4646
};
4747

4848
const formatPDFDate = (date: Date) => {
4949
return date.toISOString().replace(/\.\d{3}Z$/, ''); // Removes milliseconds & Zulu time
5050
};
5151

5252
// Generisk metode for kall til mot Gotenberg gitt rute og preparert FormData
53-
export const callGotenberg = async (route: string, formData: FormData): Promise<any> => {
54-
console.log(`Calling Gotenberg with url = ${gotenbergUrl}${route}`);
53+
export const callGotenberg = async (language: string, route: string, formData: FormData): Promise<any> => {
54+
const url = language.toLowerCase().startsWith('en') ? gotenbergUrlEn : gotenbergUrl;
55+
console.log(`Calling Gotenberg with url = ${url}/${route}`);
5556

5657
try {
5758
// Send the request to Gotenberg
58-
const gotenbergResponse = await fetchWithRetry(`${gotenbergUrl}${route}`, {
59+
const gotenbergResponse = await fetchWithRetry(`${url}${route}`, {
5960
retry: 1,
6061
headers: {
6162
accept: 'application/pdf, text/plain',

0 commit comments

Comments
 (0)