This commit is contained in:
AceDataCloud committed 2023-01-25 23:35:37 +08:00
1 parent a3e1a93524
commit 537ef21cf3
6 files changed
+29 -9

No files matched your search

+13 -1
View File
@@ -1,7 +1,19 @@
import { ENV_LOCAL, ENV_PRODUCTION, ENV_TEST } from '@/constants';
const PATTERN_TEST_ENV = '.test.zhishuyun.com';
const PATTERN_LOCAL_ENV = '.lcoal.zhishuyun.com';
/**
* Get env of App, return local, test, production
* @returns
*/
export const getEnv = () => {
return import.meta.env.VITE_APP_ENV;
const host = window.location.host;
if (host.indexOf(PATTERN_LOCAL_ENV) > 0) {
return ENV_LOCAL;
}
if (host.indexOf(PATTERN_TEST_ENV) > 0) {
return ENV_TEST;
}
return ENV_PRODUCTION;
};