From 900bb5e845c3ad44defbd427cae3d44a4a43321f Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Sat, 25 Feb 2023 13:15:44 +0100 Subject: feat: Initial commit --- code/app/src/configuration/index.ts | 64 +++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 code/app/src/configuration/index.ts (limited to 'code/app/src/configuration') diff --git a/code/app/src/configuration/index.ts b/code/app/src/configuration/index.ts new file mode 100644 index 0000000..abf6ac5 --- /dev/null +++ b/code/app/src/configuration/index.ts @@ -0,0 +1,64 @@ +import { env } from "$env/dynamic/private"; + +export const APP_ADDRESS = "https://stage.greatoffice.app"; +export const API_ADDRESS = "https://stage-api.greatoffice.app"; +export const DEV_APP_ADDRESS = "http://localhost"; +export const DEV_API_ADDRESS = "http://localhost:5000"; + +export function api_base(path: string = "", explicitVersion = 1): string { + if (path && !path.startsWith("_")) path = "v" + explicitVersion + path; + return (is_development() ? DEV_API_ADDRESS : API_ADDRESS) + (path !== "" ? "/" + path : ""); +} + +export function is_development(): boolean { + return import.meta.env.DEV; +} + +export function is_testing(): boolean { + return env.TESTING == "true"; +} + +export function is_debug(): boolean { + return localStorage.getItem(StorageKeys.debug) !== "true"; +} + +export const CookieNames = { + theme: "go_theme", + locale: "go_locale", + session: "go_session", +}; + +export function get_test_context(): TestContext { + return { + user: { + username: env.TEST_USERNAME, + password: env.TEST_PASSWORD, + }, + }; +} + +export interface TestContext { + user: { + username: string, + password: string + }; +} + +export const QueryKeys = { + labels: "labels", + categories: "categories", + entries: "entries", +}; + +export const StorageKeys = { + session: "sessionData", + theme: "theme", + debug: "debug", + categories: "categories", + labels: "labels", + entries: "entries", + stopwatch: "stopwatchState", + logLevel: "logLevel", +}; + +export type PortalMessage = "emailValidated"; \ No newline at end of file -- cgit v1.3