|
@ -11,11 +11,14 @@ import org.springframework.core.env.Environment; |
|
|
* @date 2020-07-03 11:14 |
|
|
* @date 2020-07-03 11:14 |
|
|
**/ |
|
|
**/ |
|
|
public enum EnvEnum { |
|
|
public enum EnvEnum { |
|
|
LOCAL("local", "本地环境","http://localhost:8080/api/"), |
|
|
/** |
|
|
DEV("dev", "开发环境","http://192.168.1.130:8080/api/"), |
|
|
* 环境变量枚举 |
|
|
TEST("test", "体验环境","https://epmet-dev.elinkservice.cn/api/"), |
|
|
*/ |
|
|
PROD("prod", "生产环境","https://epmet-cloud.elinkservice.cn/api/"), |
|
|
LOCAL("local", "本地环境", "http://localhost:8080/api/"), |
|
|
UN_KNOWN("un_known", "未知","https://epmet-dev.elinkservice.cn/api/"), |
|
|
DEV("dev", "开发环境", "http://192.168.1.130:8080/api/"), |
|
|
|
|
|
TEST("test", "体验环境", "https://epmet-dev.elinkservice.cn/api/"), |
|
|
|
|
|
PROD("prod", "生产环境", "https://epmet-cloud.elinkservice.cn/api/"), |
|
|
|
|
|
UN_KNOWN("un_known", "未知", "https://epmet-dev.elinkservice.cn/api/"), |
|
|
; |
|
|
; |
|
|
|
|
|
|
|
|
private String code; |
|
|
private String code; |
|
@ -44,7 +47,7 @@ public enum EnvEnum { |
|
|
try { |
|
|
try { |
|
|
Environment environment = SpringContextUtils.getBean(Environment.class); |
|
|
Environment environment = SpringContextUtils.getBean(Environment.class); |
|
|
String[] activeProfiles = environment.getActiveProfiles(); |
|
|
String[] activeProfiles = environment.getActiveProfiles(); |
|
|
if (activeProfiles != null && activeProfiles.length > 0) { |
|
|
if (activeProfiles.length > 0) { |
|
|
return getEnum(activeProfiles[0]); |
|
|
return getEnum(activeProfiles[0]); |
|
|
} |
|
|
} |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|