You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.3 KiB
51 lines
1.3 KiB
5 years ago
|
import java.io.IOException;
|
||
|
import java.util.Properties;
|
||
|
|
||
|
/**
|
||
|
* Created by liuhai.lh on 17/01/12.
|
||
|
*/
|
||
|
public class BaseSample {
|
||
|
|
||
|
protected static String accessKeyId = "123";
|
||
|
protected static String accessKeySecret = "456";
|
||
|
|
||
|
protected static String regionId = "cn-shanghai";
|
||
|
|
||
|
static {
|
||
|
Properties properties = new Properties();
|
||
|
|
||
|
try {
|
||
|
properties.load(BaseSample.class.getResourceAsStream("bootstrap.yml"));
|
||
|
accessKeyId = properties.getProperty("aliyun.green.accessKeyId");
|
||
|
accessKeySecret = properties.getProperty("aliyun.green.accessKeySecret");
|
||
|
regionId = properties.getProperty("aliyun.green.url");
|
||
|
} catch(IOException e) {
|
||
|
e.printStackTrace();
|
||
|
}
|
||
|
|
||
|
}
|
||
|
protected static String getDomain(){
|
||
|
if("cn-shanghai".equals(regionId)){
|
||
|
return "green.cn-shanghai.aliyuncs.com";
|
||
|
}
|
||
|
|
||
|
if ("cn-beijing".equals(regionId)) {
|
||
|
return "green.cn-beijing.aliyuncs.com";
|
||
|
}
|
||
|
|
||
|
if ("ap-southeast-1".equals(regionId)) {
|
||
|
return "green.ap-southeast-1.aliyuncs.com";
|
||
|
}
|
||
|
|
||
|
if ("us-west-1".equals(regionId)) {
|
||
|
return "green.us-west-1.aliyuncs.com";
|
||
|
}
|
||
|
|
||
|
return "green.cn-shanghai.aliyuncs.com";
|
||
|
}
|
||
|
protected static String getEndPointName(){
|
||
|
return regionId;
|
||
|
}
|
||
|
|
||
|
}
|