Skip to content

Commit

Permalink
IS-1912: Add flexjar config, unnleashtoggle and post-call hook
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikdahlen committed Dec 20, 2023
1 parent d3cc141 commit 162f650
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ SYFOVEILEDER_AAD_APP_CLIENT_ID=dev-fss.teamsykefravr.syfoveileder
SYFOVEILEDER_HOST=syfoveileder.dev.intern.nav.no
ESYFOVARSEL_AAD_APP_CLIENT_ID=dev-gcp.team-esyfo.esyfovarsel
ESYFOVARSEL_HOST=http://esyfovarsel.intern.dev.no
FLEXJAR_AAD_APP_CLIENT_ID=dev-gcp.flex.flexjar-backend
FLEXJAR_HOST=http://flexjar-backend.intern.dev.nav.no
UNLEASH_SERVER_API_URL=https://teamsykefravr-unleash-api.nav.cloud.nais.io/api
UNLEASH_SERVER_API_TOKEN=kjempesikkert-token
LOG_LEVEL=debug
6 changes: 6 additions & 0 deletions .nais/naiserator-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ spec:
namespace: teamsykmelding
- application: sykepengesoknad-backend
namespace: flex
- application: flexjar-backend
namespace: flex
- application: syfomodiaperson-redis
- application: esyfovarsel
namespace: team-esyfo
Expand Down Expand Up @@ -179,4 +181,8 @@ spec:
value: "dev-gcp.team-esyfo.esyfovarsel"
- name: ESYFOVARSEL_HOST
value: "http://esyfovarsel.team-esyfo"
- name: FLEXJAR_AAD_APP_CLIENT_ID
value: "dev-gcp.flex.flexjar-backend"
- name: FLEXJAR_HOST
value: "http://flexjar-backend.flex"

6 changes: 6 additions & 0 deletions .nais/naiserator-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ spec:
namespace: teamsykmelding
- application: sykepengesoknad-backend
namespace: flex
- application: flexjar-backend
namespace: flex
- application: syfomodiaperson-redis
- application: esyfovarsel
namespace: team-esyfo
Expand Down Expand Up @@ -179,3 +181,7 @@ spec:
value: "prod-gcp.team-esyfo.esyfovarsel"
- name: ESYFOVARSEL_HOST
value: "http://esyfovarsel.team-esyfo"
- name: FLEXJAR_AAD_APP_CLIENT_ID
value: "prod-gcp.flex.flexjar-backend"
- name: FLEXJAR_HOST
value: "http://flexjar-backend.flex"
11 changes: 11 additions & 0 deletions mock/flexjar/mockFlexjar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { FLEXJAR_ROOT } from "../../src/apiConstants";
import express from "express";

export const mockFlexjar = (server: any) => {
server.post(
`${FLEXJAR_ROOT}/feedback/azure`,
(req: express.Request, res: express.Response) => {
res.sendStatus(200);
}
);
};
2 changes: 2 additions & 0 deletions mock/mockEndepunkter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { mockEsyfovarsel } from "./esyfovarsel/mockEsyfovarsel";

import express from "express";
import { mockIshuskelapp } from "./huskelapp/mockHuskelapp";
import { mockFlexjar } from "./flexjar/mockFlexjar";

const mockEndepunkter = (server: any) => {
server.use(express.json());
Expand All @@ -32,6 +33,7 @@ const mockEndepunkter = (server: any) => {
mockEreg,
mockEsyfovarsel,
mockFastlegerest,
mockFlexjar,
mockIsnarmesteleder,
mockIsoppfolgingstilfelle,
mockIspersonoppgave,
Expand Down
9 changes: 9 additions & 0 deletions server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,15 @@ export const auth = {
}),
removePathPrefix: true,
},
flexjar: {
applicationName: "flexjar-backend",
clientId: envVar({
name: "FLEXJAR_AAD_APP_CLIENT_ID",
}),
host: envVar({
name: "FLEXJAR_HOST",
}),
},
};

export const redis = {
Expand Down
11 changes: 11 additions & 0 deletions server/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,17 @@ export const setupProxy = (
}
);

router.use(
"/flexjar-backend/*",
(
req: express.Request,
res: express.Response,
next: express.NextFunction
) => {
proxyOnBehalfOf(req, res, next, authClient, issuer, Config.auth.flexjar);
}
);

router.use(
"/internarbeidsflatedecorator",
proxy(Config.auth.internarbeidsflatedecoratorHost, {
Expand Down
1 change: 1 addition & 0 deletions server/unleash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ export const getToggles = (veilederId, enhetId) => {
context
),
isHuskelappEnabled: unleash.isEnabled("isHuskelappEnabled", context),
isFlexjarEnabled: unleash.isEnabled("isFlexjarEnabled", context),
};
};
1 change: 1 addition & 0 deletions src/apiConstants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export const EREG_ROOT = "/ereg/api/v1";
export const ESYFOVARSEL_ROOT = "/esyfovarsel/api/azure/v2";
export const FASTLEGEREST_ROOT = "/fastlegerest/api/v2/fastlege";
export const FLEXJAR_ROOT = "/flexjar-backend/api/v1";
export const ISAKTIVITETSKRAV_ROOT = "/isaktivitetskrav/api/internad/v1";
export const ISBEHANDLERDIALOG_ROOT = "/isbehandlerdialog/api/internad/v1";
export const ISDIALOGMOTE_ROOT = "/isdialogmote/api/v2";
Expand Down
20 changes: 20 additions & 0 deletions src/data/flexjar/useFlexjarFeedback.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { useMutation } from "@tanstack/react-query";
import { FLEXJAR_ROOT } from "@/apiConstants";
import { post } from "@/api/axios";

export const useFlexjarFeedback = () => {
const path = `${FLEXJAR_ROOT}/feedback/azure`;
const postFlexjarFeedback = (feedback: FlexjarFeedbackDTO) =>
post(path, feedback);

return useMutation({
mutationFn: postFlexjarFeedback,
});
};

export interface FlexjarFeedbackDTO {
feedbackId: string;
feedback: string | null;
svar: string | null;
app: string;
}
2 changes: 2 additions & 0 deletions src/data/unleash/unleash_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ export type Toggles = {
export enum ToggleNames {
isVirksomhetsinputEnabled = "isVirksomhetsinputEnabled",
isHuskelappEnabled = "isHuskelappEnabled",
isFlexjarEnabled = "isFlexjarEnabled",
}

export const defaultToggles: Toggles = {
isVirksomhetsinputEnabled: false,
isHuskelappEnabled: false,
isFlexjarEnabled: false,
};

0 comments on commit 162f650

Please sign in to comment.