-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat. Fjerne express-http-proxy og heller bruke http-proxy-middelware
- Loading branch information
Showing
18 changed files
with
427 additions
and
519 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
enum Miljo { | ||
LABS = 'dev-gcp-labs', | ||
DEV_GCP = 'dev-gcp', | ||
PROD_GCP = 'prod-gcp', | ||
LOCALHOST = 'localhost', | ||
} | ||
|
||
const miljoMap: Record<string, Miljo> = { | ||
'dev-gcp-labs': Miljo.LABS, | ||
'dev-gcp': Miljo.DEV_GCP, | ||
'prod-gcp': Miljo.PROD_GCP, | ||
localhost: Miljo.LOCALHOST, | ||
}; | ||
|
||
enum Env { | ||
PROD = 'prod', | ||
DEV = 'dev', | ||
} | ||
|
||
const MILJO = miljoMap[process.env.MILJO] ?? Miljo.LOCALHOST; | ||
export const PORT = process.env.PORT ?? '3000'; | ||
export const ENV = MILJO === Miljo.PROD_GCP ? Env.PROD : Env.DEV; | ||
|
||
export const APIGW_URL = MILJO !== Miljo.LOCALHOST ? process.env.APIGW_URL : 'http://localhost:8080'; | ||
export const API_AUDIENCE = MILJO !== Miljo.LOCALHOST ? process.env.API_AUDIENCE : 'dummy-audience'; | ||
export const ARBEIDSGIVER_DIALOG_URL = | ||
MILJO !== Miljo.LOCALHOST ? process.env.ARBEIDSGIVER_DIALOG_URL : 'http://localhost:8080'; | ||
export const DECORATOR_EXTERNAL_URL = | ||
MILJO !== Miljo.LOCALHOST ? process.env.DECORATOR_EXTERNAL_URL : 'http://localhost:8080'; | ||
export const DECORATOR_INTERNAL = | ||
MILJO !== Miljo.LOCALHOST ? process.env.DECORATOR_INTERNAL : 'https://internarbeidsflatedecorator.intern.nav.no'; | ||
export const DECORATOR_INTERNAL_SCRIPT = | ||
MILJO !== Miljo.LOCALHOST | ||
? process.env.DECORATOR_INTERNAL_SCRIPT | ||
: 'https://internarbeidsflatedecorator-q0.dev.adeo.no/internarbeidsflatedecorator/v2.1/static/js/head.v2.min.js'; | ||
export const DECORATOR_INTERNAL_STYLING = | ||
MILJO !== Miljo.LOCALHOST | ||
? process.env.DECORATOR_INTERNAL_STYLING | ||
: 'https://internarbeidsflatedecorator-q0.dev.adeo.no/internarbeidsflatedecorator/v2.1/static/js/head.v2.min.js'; | ||
export const ENABLE_EXTERNAL_MENU = process.env.ENABLE_EXTERNAL_MENU === 'true'; | ||
export const ENABLE_INTERNAL_MENU = process.env.ENABLE_INTERNAL_MENU === 'true'; | ||
export const INTERN_INGRESS = process.env.INTERN_INGRESS === 'true'; | ||
export const LOGIN_URL = MILJO !== Miljo.LOCALHOST ? process.env.LOGIN_URL : 'http://localhost:8080'; | ||
export const LOGOUT_URL = MILJO !== Miljo.LOCALHOST ? process.env.LOGOUT_URL : 'http://localhost:8080'; | ||
export const MODIACONTEXTHOLDER_API_SCOPE = | ||
MILJO !== Miljo.LOCALHOST ? process.env.MODIACONTEXTHOLDER_API_SCOPE : 'dummy-scope'; | ||
export const NOTIFIKASJON_AUDIENCE = MILJO !== Miljo.LOCALHOST ? process.env.NOTIFIKASJON_AUDIENCE : 'dummy-audience'; | ||
export const NOTIFIKASJON_URL = MILJO !== Miljo.LOCALHOST ? process.env.NOTIFIKASJON_URL : 'http://localhost:8080'; | ||
export const STILLINGSTITLER_URL = | ||
MILJO !== Miljo.LOCALHOST ? process.env.STILLINGSTITLER_URL : 'http://localhost:8080'; | ||
export const TILTAK_PROXY_API_SCOPE = MILJO !== Miljo.LOCALHOST ? process.env.TILTAK_PROXY_API_SCOPE : 'dummy-scope'; | ||
export const IS_LABS = | ||
MILJO === Miljo.LOCALHOST | ||
? process.env.LABS === 'true' | ||
: MILJO === Miljo.LABS || ![Miljo.DEV_GCP, Miljo.PROD_GCP].includes(MILJO); | ||
export const IS_LOCALHOST = MILJO === Miljo.LOCALHOST; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,25 @@ | ||
import { injectDecoratorServerSide } from '@navikt/nav-dekoratoren-moduler/ssr'; | ||
import { Request, Response } from 'express-serve-static-core'; | ||
import { Request, Response } from 'express'; | ||
|
||
import { getEnv } from '../paths/miljo'; | ||
import { ENV } from '../config'; | ||
|
||
async function getNavdekoratoren( | ||
indexFilepath: string, | ||
req: Request, | ||
res: Response<any, Record<string, any>, number>, | ||
): Promise<void> { | ||
const contextBasertPåInnloggetPart = req.cookies['innlogget-part'] === 'DELTAKER' ? 'privatperson' : 'arbeidsgiver'; | ||
return await injectDecoratorServerSide({ | ||
env: getEnv(), | ||
filePath: indexFilepath, | ||
params: { | ||
context: contextBasertPåInnloggetPart, | ||
chatbot: true, | ||
redirectToApp: true, | ||
level: 'Level4', | ||
language: 'nb', | ||
}, | ||
}) | ||
.then((html) => { | ||
res.send(html); | ||
}) | ||
.catch((err) => console.log('Feil ved henting av dekorator: ', err)); | ||
} | ||
export async function getNavdekoratoren(indexFilepath: string, req: Request, res: Response): Promise<void> { | ||
const context = req.cookies['innlogget-part'] === 'DELTAKER' ? 'privatperson' : 'arbeidsgiver'; | ||
try { | ||
const html = await injectDecoratorServerSide({ | ||
env: ENV, | ||
filePath: indexFilepath, | ||
params: { | ||
context, | ||
chatbot: true, | ||
redirectToApp: true, | ||
level: 'Level4', | ||
language: 'nb', | ||
}, | ||
}); | ||
|
||
export default { getNavdekoratoren }; | ||
res.send(html); | ||
} catch (error) { | ||
console.log('Feil ved henting av dekorator: ', error); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.