Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,11 @@ const env = import.meta.env as Record<string, string>
export default env

// The name of the current service.
export const SERVICE_NAME = env.VITE_SERVICE_NAME ?? "replace-me"

// If the current service the root service. This will only be true for portal.
export const SERVICE_IS_ROOT = Boolean(Number(env.VITE_SERVICE_IS_ROOT ?? "0"))

// The protocol, domain and port of the current service.
export const SERVICE_PROTOCOL = env.VITE_SERVICE_PROTOCOL ?? "http"
export const SERVICE_DOMAIN = env.VITE_SERVICE_DOMAIN ?? "localhost"
export const SERVICE_PORT = Number(env.VITE_SERVICE_PORT ?? "8000")

// The base url of the current service.
// The root service does not need its name included in the base url.
export const SERVICE_BASE_URL =
`${SERVICE_PROTOCOL}://${SERVICE_DOMAIN}:${SERVICE_PORT}` +
(SERVICE_IS_ROOT ? "" : `/${SERVICE_NAME}`)
export const SERVICE_NAME = env.VITE_SERVICE_NAME ?? "REPLACE_ME"

// The api url of the current service.
export const SERVICE_API_URL = `${SERVICE_BASE_URL}/api`
export const SERVICE_API_URL =
env.VITE_SERVICE_API_URL ?? "http://localhost:8000"

// The names of cookies.
export const CSRF_COOKIE_NAME = `${SERVICE_NAME}_csrftoken`
Expand Down
Loading