declare const __VITE_API_BASE_URL__: string | undefined;

const DEFAULT_API_BASE_URL = "http://localhost:8000";

const rawApiBaseUrl =
  (typeof __VITE_API_BASE_URL__ !== "undefined" ? __VITE_API_BASE_URL__ : undefined) ??
  DEFAULT_API_BASE_URL;

export const API_BASE_URL = rawApiBaseUrl.endsWith("/")
  ? rawApiBaseUrl.slice(0, -1)
  : rawApiBaseUrl;
