forked from cohstats/coh3-stats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.ts
47 lines (40 loc) · 1.16 KB
/
config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import packageJson from "./package.json";
import { isBrowserEnv } from "./src/utils";
const { repository } = packageJson;
export interface FirebaseConfig {
apiKey: string;
authDomain: string;
projectId: string;
messagingSenderId: string;
appId: string;
measurementId: string;
databaseURL: string;
storageBucket: string;
}
const getFirebaseConfig = (): FirebaseConfig =>
JSON.parse(process.env.NEXT_PUBLIC_APP_FIREBASE_CONFIG || "{}");
const firebaseFunctions = {
location: "us-east4",
};
const isDevEnv = (): boolean => {
// Browser env
if (isBrowserEnv()) {
return window.location.hostname !== "coh3stats.com";
}
// Server env
return process.env.EDGIO_ENVIRONMENT_NAME !== "prod";
};
const getEdgioEnvName = (): string | null => {
return process.env.EDGIO_ENVIRONMENT_NAME || null;
};
const config = {
getFirebaseConfig,
isDevEnv,
getEdgioEnvName,
firebaseFunctions,
DISCORD_INVITE_LINK: "https://discord.gg/jRrnwqMfkr",
DONATION_LINK: "https://ko-fi.com/cohstats",
GITHUB_LINK: repository.url,
BASE_CLOUD_FUNCTIONS_URL: `https://${firebaseFunctions.location}-coh3-stats-prod.cloudfunctions.net`,
};
export default config;