Skip to content

Commit

Permalink
Merge pull request #2265 from navikt/ansatt-ingress
Browse files Browse the repository at this point in the history
Serve på ansatt.dev.nav.no ingress
  • Loading branch information
LudvigHz authored Sep 5, 2024
2 parents e390b1a + 298fa73 commit 47e1ac9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions .nais/dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ spec:
memory: 1536Mi
ingresses:
- https://modiapersonoversikt.intern.dev.nav.no
- https://modiapersonoversikt.ansatt.dev.nav.no
- https://modiaflate.intern.dev.nav.no
replicas:
min: 2
Expand Down
2 changes: 1 addition & 1 deletion src/app/internarbeidsflatedecorator/decoratorprops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export type Hotkey = ActionHotkey | DocumentingHotkey;

export type Environment = 'q0' | 'q1' | 'q2' | 'q3' | 'q4' | 'prod' | 'local' | 'mock';

type UrlFormat = 'LOCAL' | 'ADEO' | 'NAV_NO';
type UrlFormat = 'LOCAL' | 'NAV_NO' | 'ANSATT';

export interface DecoratorPropsV3 {
appName: string;
Expand Down
6 changes: 4 additions & 2 deletions src/app/internarbeidsflatedecorator/useDecoratorConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { trackNavigation, updateUserEnhet } from '../../utils/amplitude';
import { useCallback } from 'react';
import { DecoratorPropsV3, Hotkey } from './decoratorprops';
import { useGjeldendeBruker } from '../../redux/gjeldendeBruker/types';
import { getEnvFromHost } from '../../utils/environment';
import { getDomainFromHost, getEnvFromHost } from '../../utils/environment';
import { useRouteMatch } from 'react-router';
import config from '../../config';

Expand Down Expand Up @@ -77,6 +77,8 @@ function lagConfigV3(
const onsketFnr = urlFnr ?? sokFnr ?? fnr;
const environment = import.meta.env.PROD ? getEnvFromHost() : 'mock';

const urlFormat = getDomainFromHost();

return {
appName: 'Modia personoversikt',
fnr: onsketFnr ?? undefined,
Expand Down Expand Up @@ -108,7 +110,7 @@ function lagConfigV3(
? `https://${window.location.host}${import.meta.env.BASE_URL}proxy/modiacontextholder`
: (import.meta.env.VITE_CONTEXTHOLDER_URL ?? `${import.meta.env.BASE_URL}proxy/modiacontextholder`),
environment,
urlFormat: import.meta.env.PROD ? (window.location.host.includes('adeo.no') ? 'ADEO' : 'NAV_NO') : 'LOCAL',
urlFormat: import.meta.env.PROD ? urlFormat : 'LOCAL',
showEnheter: true,
showSearchArea: true,
fetchActiveUserOnMount: true,
Expand Down
10 changes: 10 additions & 0 deletions src/utils/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,13 @@ export const getEnvFromHost = () => {
}
return 'mock';
};

export const getDomainFromHost = (): 'ANSATT' | 'NAV_NO' | 'LOCAL' => {
const matchAnsatt = window.location.host.match(/\.ansatt\.(dev)?\.nav\.no/);
if (matchAnsatt) return 'ANSATT';

const matchIntern = window.location.host.match(/\.intern\.(dev)?\.nav\.no/);
if (matchIntern) return 'NAV_NO';

return 'LOCAL';
};

0 comments on commit 47e1ac9

Please sign in to comment.