1
2
3
4
5
6
7
8
9
10
11
12
function envOrUndefined(key: string): string | undefined {
// try/catch prevents crashes if the script doesn't have env access
try {
return Deno.env.get("VALTOWN_API_URL");
} catch {}
}
export function getApiUrl(): string {
return envOrUndefined("VALTOWN_API_URL") ?? "https://api.val.town";
}
export const API_URL = getApiUrl();