server host

This commit is contained in:
Robert 2024-03-07 05:16:40 +07:00
parent a826caafad
commit b16c2b395d
No known key found for this signature in database
GPG Key ID: F631C7FD957D5F22
2 changed files with 7 additions and 0 deletions

1
.env.template Normal file
View File

@ -0,0 +1 @@
VITE_SERVER_HOST # Required. Example api.website.com

6
src/shared/config.ts Normal file
View File

@ -0,0 +1,6 @@
import { getEnvVar } from "./lib/getEnvVar";
export const SERVER_HOST = getEnvVar("VITE_SERVER_HOST");
export const IS_SSL = window.location.protocol === "https:";
export const API_HOST = `${IS_SSL ? "https://" : "http://"}${SERVER_HOST}/api`;