Skip to content
This repository was archived by the owner on Mar 6, 2024. It is now read-only.

Commit 3b569ff

Browse files
committed
更新配置类
1 parent b1f5862 commit 3b569ff

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

src/main/java/org/code4everything/qiniu/api/SdkConfigurer.java

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@
88
import com.qiniu.storage.persistent.FileRecorder;
99
import com.qiniu.util.Auth;
1010
import com.zhazhapan.util.Utils;
11-
import javafx.application.Platform;
1211
import org.apache.log4j.Logger;
13-
import org.code4everything.qiniu.constant.QiniuValueConsts;
14-
import org.code4everything.qiniu.util.DialogUtils;
15-
import org.code4everything.qiniu.util.QiniuUtils;
1612

1713
import java.io.IOException;
1814
import java.nio.file.Paths;
@@ -24,6 +20,8 @@
2420
*/
2521
public class SdkConfigurer {
2622

23+
private static final String[] BUCKET_NAME_ARRAY = {"华东", "华北", "华南", "北美"};
24+
2725
private static final Map<String, Zone> ZONE = new HashMap<>();
2826

2927
private static final Logger LOGGER = Logger.getLogger(SdkConfigurer.class);
@@ -38,10 +36,10 @@ public class SdkConfigurer {
3836

3937
static {
4038
// 加载空间区域
41-
ZONE.put(QiniuValueConsts.BUCKET_NAME_ARRAY[0], Zone.zone0());
42-
ZONE.put(QiniuValueConsts.BUCKET_NAME_ARRAY[1], Zone.zone1());
43-
ZONE.put(QiniuValueConsts.BUCKET_NAME_ARRAY[2], Zone.zone2());
44-
ZONE.put(QiniuValueConsts.BUCKET_NAME_ARRAY[3], Zone.zoneNa0());
39+
ZONE.put(BUCKET_NAME_ARRAY[0], Zone.zone0());
40+
ZONE.put(BUCKET_NAME_ARRAY[1], Zone.zone1());
41+
ZONE.put(BUCKET_NAME_ARRAY[2], Zone.zone2());
42+
ZONE.put(BUCKET_NAME_ARRAY[3], Zone.zoneNa0());
4543
}
4644

4745
private SdkConfigurer() {}
@@ -71,17 +69,9 @@ public static void createAuth(String accessKey, String secretKey) {
7169
}
7270

7371
/**
74-
* 配置文件上传环境
72+
* 配置文件上传环境,不再做网络检查,请执行保证网络通畅
7573
*/
7674
public static boolean configUploadEnv(String zone, String bucket) {
77-
if (!QiniuUtils.checkNet()) {
78-
Platform.runLater(() -> {
79-
DialogUtils.showError(QiniuValueConsts.NET_ERROR);
80-
System.exit(0);
81-
});
82-
return false;
83-
}
84-
LOGGER.info("config file upload environment");
8575
// 构造一个带指定Zone对象的配置类
8676
Configuration configuration = new Configuration(SdkConfigurer.ZONE.get(zone));
8777
// 生成上传凭证,然后准备上传

0 commit comments

Comments
 (0)