-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenv.ts
47 lines (37 loc) · 866 Bytes
/
env.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 Constants from "expo-constants";
enum AvailableEnvironments {
dev = "dev",
prod = "prod",
}
type Environment = {
API_URL?: string;
env: AvailableEnvironments;
};
const environments = {
dev: {
API_URL: "http://192.168.1.109:8080",
},
prod: {},
};
const common = {};
const currentEnvironment = ((): AvailableEnvironments => {
switch (Constants?.manifest?.releaseChannel) {
case "master":
case "default":
return AvailableEnvironments.prod;
default:
return AvailableEnvironments.dev;
}
})();
const env: Environment = {
...common,
...environments[currentEnvironment],
env: currentEnvironment,
};
export const buildUriFromSubdomain = (subdomain: string) => {
if (subdomain === "local" && env.API_URL) {
return env.API_URL;
}
return `https://${subdomain}.foundu.com.au`;
};
export default env;