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

import com.ui.contants.ProjectConstant;

import java.util.*;

public class ProjectEnvironment {


	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<>();

	//docker相关
	private static Map<String,String> dockerProjectTypeMap=new LinkedHashMap<>();

	//项目发布的方式
	private static Map<String,String> projectDeployTypeMap=new LinkedHashMap<>();

	static{
		map.put("aws", "http://"+ ProjectConstant.DEPLOY_IP+":8883/web/");
		map.put("qcloud","http://"+ ProjectConstant.DEPLOY_IP+":8883/web/");
		map.put("qcloud_gray","http://"+ ProjectConstant.DEPLOY_IP+":8883/web/");
		map.put("aws_gray","http://"+ ProjectConstant.DEPLOY_IP+":8883/web/");

		dockerProjectTypeMap.put("web","web");
		dockerProjectTypeMap.put("media","media");
		dockerProjectTypeMap.put("java","java");
		dockerProjectTypeMap.put("ops","ops");
		dockerProjectTypeMap.put("erp","erp");
		dockerProjectTypeMap.put("jenkins-deploy","jenkins-deploy");

		projectDeployTypeMap.put("git","git分支");
		projectDeployTypeMap.put("image","镜像文件");

	}


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


	public static List<String> getDockerEnvironments(String projectName){
		if (projectName==null) return dockerEnvironments;
		if(projectName!=null&&projectName.contains("yohobuywap-node")){
			return dockerEnvironments;
		}
		if(projectName!=null&&projectName.contains("yoho-community-web")){
			return dockerEnvironments;
		}
		if(projectName!=null&&projectName.contains("yohobuy-node")){
			return dockerEnvironments;
		}
		if(projectName!=null&&projectName.contains("ufo-app-web")){
			return dockerEnvironments;
		}
		if(projectName!=null&&projectName.contains("yoho-app-web")){
			return dockerEnvironments;
		}
		if(projectName!=null&&projectName.contains("ultrainBlockApi")){
			return dockerEnvironments;
		}
		if(projectName!=null&&projectName.contains("yohobuywap-node-activity")){
			return dockerEnvironments;
		}
		if(projectName!=null&&projectName.contains("xianyu-ufo-app-web")){
			return dockerEnvironments;
		}
		if(projectName!=null&&projectName.contains("xianyuservice")){
			return dockerEnvironments;
		}
		return Arrays.asList("yoho-online");
	}

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

	public static Map<String,String> getProjectDeployTypeMap(){
		return projectDeployTypeMap;
	}


}