Skip to content

Commit

Permalink
allow pentest
Browse files Browse the repository at this point in the history
  • Loading branch information
bbohec committed Jan 22, 2025
1 parent e5ba6e7 commit e4e3a47
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 6 deletions.
3 changes: 2 additions & 1 deletion back/src/config/bootstrap/appConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { trim } from "ramda";
import {
AbsoluteUrl,
ProcessEnv,
environments,
filterNotFalsy,
inclusionConnectImmersionRoutes,
makeGetBooleanVariable,
Expand Down Expand Up @@ -242,7 +243,7 @@ export class AppConfig {
public get envType() {
return this.#throwIfNotInArray({
variableName: "ENV_TYPE",
authorizedValues: ["dev", "staging", "production", "local"],
authorizedValues: [...environments],
defaultValue: "local",
});
}
Expand Down
2 changes: 2 additions & 0 deletions front/src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export const App = () => {
local:
"https://matomo.inclusion.beta.gouv.fr/js/container_gXlljpZ7_dev_d2e47aeaf37d823506115b8a.js",
dev: "https://matomo.inclusion.beta.gouv.fr/js/container_gXlljpZ7_dev_d2e47aeaf37d823506115b8a.js",
pentest:
"https://matomo.inclusion.beta.gouv.fr/js/container_gXlljpZ7_pentest_a8b07fda200254c3602d860a.js",
staging:
"https://matomo.inclusion.beta.gouv.fr/js/container_gXlljpZ7_staging_60e68dc0e23bda19899cf43d.js",
production:
Expand Down
8 changes: 6 additions & 2 deletions front/src/config/environmentVariables.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { makeGetBooleanVariable, makeThrowIfNotInArray } from "shared";
import {
environments,
makeGetBooleanVariable,
makeThrowIfNotInArray,
} from "shared";

const windowEnv: Record<string, string | undefined> = (window as any)._env_;
if (!windowEnv)
Expand All @@ -10,7 +14,7 @@ const getBoolean = makeGetBooleanVariable(windowEnv);
export const ENV = {
envType: throwIfNotInArray({
variableName: "VITE_ENV_TYPE",
authorizedValues: ["dev", "staging", "production", "local"],
authorizedValues: [...environments],
defaultValue: "local",
}),
gateway: throwIfNotInArray({
Expand Down
6 changes: 3 additions & 3 deletions shared/src/admin/adminTabs.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { keys } from "ramda";
import { Environment } from "../environment";

type AdminTabProps = {
slug: string;
isVisible: (env: "dev" | "staging" | "production" | "local") => boolean;
isVisible: (env: Environment) => boolean;
};

export const adminTabs = {
Expand All @@ -28,8 +29,7 @@ export const adminTabs = {
},
adminNotifications: {
slug: "notifications",
isVisible: (env: "dev" | "staging" | "production" | "local") =>
env !== "production",
isVisible: (env: Environment) => env !== "production",
},
adminEmailPreview: {
slug: "email-preview",
Expand Down
8 changes: 8 additions & 0 deletions shared/src/environment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const environments = [
"dev",
"staging",
"pentest",
"production",
"local",
] as const;
export type Environment = (typeof environments)[number];
1 change: 1 addition & 0 deletions shared/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,4 @@ export * from "./utils/string";
export * from "./utils/toDotNotation";
export * from "./zodUtils";
export * from "./establishment/superEstablishment";
export * from "./environment";

0 comments on commit e4e3a47

Please sign in to comment.