ProjectEnvironment.java 2.48 KB
package com.ui.project;

import java.util.*;

public class ProjectEnvironment {

	private static List<String> JAVA_ENV_LIST=new ArrayList<>();
	private static List<String> JAVA_ENV_LIST_QCLOUD = Arrays.asList("qcloud", "qcloud_gray");
	private static List<String> JAVA_ENV_LIST_AWS=  Arrays.asList( "aws","aws_gray");

	private static List<String> dockerEnvironments = Arrays.asList("yoho-online","yoho-gray");
	//private static String[] dockerProjectTypes = {"node","java","php","ops","other"};
	private static Map<String,String> map = new HashMap<>();
	private static Map<String,String> dockerProjectTypeMap=new LinkedHashMap<>();

	static{
		JAVA_ENV_LIST.addAll(JAVA_ENV_LIST_QCLOUD);
		JAVA_ENV_LIST.addAll(JAVA_ENV_LIST_AWS);

		map.put("aws", "http://172.31.16.167:8883/web/");
		map.put("qcloud","http://172.31.16.167:8883/web/");
		map.put("qcloud_gray","http://172.31.16.167:8883/web/");
		map.put("aws_gray","http://172.31.16.167:8883/web/");

		dockerProjectTypeMap.put("web","web");
		dockerProjectTypeMap.put("media","media");
		dockerProjectTypeMap.put("ci","核心系统ci");
		dockerProjectTypeMap.put("ops","ops");
		dockerProjectTypeMap.put("erp","erp");
	}

	public static List<String> getJavaEnvListALL() {
		return JAVA_ENV_LIST;
	}
	public static List<String> getJavaEnvList(String project) {
		if("yoho-social".equals(project)){
			List<String> ls=new ArrayList<>();
			ls.addAll(JAVA_ENV_LIST_QCLOUD);
			return ls;
		}else if("yohobuy-union".equals(project)){
			List<String> ls=new ArrayList<>();
			ls.add(JAVA_ENV_LIST_QCLOUD.get(0));
			return ls;
		}else if("cms_push".equals(project)){
			List<String> ls=new ArrayList<>();
			ls.add(JAVA_ENV_LIST_QCLOUD.get(0));
			return ls;
		}else if("yoho-push".equals(project)
				||"yoho-message".equals(project)||"yoho-message-controller".equals(project)||"yoho-message-sender".equals(project)
				||"yoho-search-adaptor".equals(project)||"yoho-search-consumer".equals(project)||"yoho-search-producer".equals(project)||"yoho-search-producer".equals(project)){
			List<String> ls=new ArrayList<>();
			ls.add(JAVA_ENV_LIST_AWS.get(0));
			ls.add(JAVA_ENV_LIST_QCLOUD.get(0));
			return ls;
		}
		return JAVA_ENV_LIST;
	}

	public static String getUrl(String envi){
		if(map.containsKey(envi)){
			return map.get(envi);
		}else{
			return "http://172.31.16.167:8883/web/";
		}
	}


	public static List<String> getDockerEnvironments(){
		return dockerEnvironments;
	}

	public static Map<String,String> getDockerProjectTypeMap(){
		return dockerProjectTypeMap;
	}

}