Skip to content

Commit

Permalink
Fix AL-207 + connection creation issues + recently removed terms not …
Browse files Browse the repository at this point in the history
…showing, remove .env file
  • Loading branch information
bindeali committed Jun 23, 2024
1 parent 0f5f3d2 commit d763a3f
Show file tree
Hide file tree
Showing 9 changed files with 1,229 additions and 1,268 deletions.
8 changes: 0 additions & 8 deletions .env

This file was deleted.

21 changes: 13 additions & 8 deletions src/config/Environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ import {
} from "@opendata-mvcr/assembly-line-shared";
import { Components } from "@opendata-mvcr/assembly-line-shared/dist/env/types";

type LocalVars =
| "PUBLIC_URL"
| "AUTHENTICATION"
| "DEBUG_DATA"
| "TERM_LANGUAGE";
type LocalVars = "PUBLIC_URL" | "AUTHENTICATION" | "DEBUG" | "TERM_LANGUAGE";

setProcessEnv(process.env);
const ENV = getEnvInstance<LocalVars>();
Expand All @@ -33,7 +29,16 @@ export const Environment: {
context: ENV.get("CONTEXT"),
id: ENV.get("ID"),
url: ENV.get("URL"),
auth: ENV.get("AUTHENTICATION", "true") === "true",
debug: ENV.get("DEBUG", "true") === "true",
language: ENV.get("TERM_LANGUAGE"),
auth: getVar("AUTHENTICATION", "true") === "true",
debug: getVar("DEBUG", "true") === "true",
language: getVar("TERM_LANGUAGE", "cs"),
};

function getVar<Type>(variable: LocalVars, fallback: Type): Type {
try {
return ENV.get(variable);
} catch (error) {
console.warn(error);
return fallback;
}
}
Loading

0 comments on commit d763a3f

Please sign in to comment.