提交 f2b7bb2e 编写于 作者: O o2sword

删除clientInit配置2

上级 69dca2d2
......@@ -178,85 +178,82 @@ public class WebServerTools extends JettySeverTools {
File file = new File(dir, "config.json");
Gson gson = XGsonBuilder.instance();
if (Config.clientInit().getEnable()) {
FileUtils.write(file, gson.toJson(Config.clientInit()), DefaultCharset.charset);
} else {
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
/** 覆盖掉配置的参数 */
com.x.base.core.project.config.CenterServer centerServerConfig = Config.nodes().centerServers().first()
.getValue();
map.putAll(centerServerConfig.getConfig());
List<Map<String, String>> centers = new ArrayList<>();
map.put("center", centers);
/** 写入center地址 */
Map<String, String> center = new HashMap<String, String>();
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
/** 覆盖掉配置的参数 */
com.x.base.core.project.config.CenterServer centerServerConfig = Config.nodes().centerServers().first()
.getValue();
map.putAll(centerServerConfig.getConfig());
List<Map<String, String>> centers = new ArrayList<>();
map.put("center", centers);
/** 写入center地址 */
Map<String, String> center = new HashMap<String, String>();
center = new HashMap<String, String>();
center.put("host", "");
center.put("port", centerServerConfig.getPort().toString());
centers.add(center);
if (!Objects.equals(centerServerConfig.getProxyPort(), centerServerConfig.getPort())) {
center = new HashMap<String, String>();
center.put("host", "");
center.put("port", centerServerConfig.getProxyPort().toString());
centers.add(center);
}
String host = Config.nodes().primaryCenterNode();
if (!Host.isRollback(host)) {
center = new HashMap<String, String>();
center.put("host", host);
center.put("port", centerServerConfig.getPort().toString());
centers.add(center);
if (!Objects.equals(centerServerConfig.getProxyPort(), centerServerConfig.getPort())) {
center = new HashMap<String, String>();
center.put("host", "");
center.put("port", centerServerConfig.getProxyPort().toString());
centers.add(center);
}
String host = Config.nodes().primaryCenterNode();
if (!Host.isRollback(host)) {
center = new HashMap<String, String>();
center.put("host", host);
center.put("port", centerServerConfig.getPort().toString());
centers.add(center);
}
/** 写入proxy地址 */
if (StringUtils.isNotEmpty(centerServerConfig.getProxyHost())) {
center = new HashMap<String, String>();
center.put("host", centerServerConfig.getProxyHost());
center.put("port", centerServerConfig.getProxyPort().toString());
centers.add(center);
}
}
/** 写入proxy地址 */
if (StringUtils.isNotEmpty(centerServerConfig.getProxyHost())) {
center = new HashMap<String, String>();
center.put("host", centerServerConfig.getProxyHost());
center.put("port", centerServerConfig.getProxyPort().toString());
centers.add(center);
}
/** 写入systemName */
map.put("footer", Config.collect().getFooter());
map.put("title", Config.collect().getTitle());
map.put("appUrl", Config.collect().getAppUrl());
/***/
if (centerServerConfig.getSslEnable()) {
map.put("app_protocol", "https:");
} else {
map.put("app_protocol", "http:");
}
/* 上面的无效 */
map.put("app_protocol", "auto");
if ((null != Config.portal().getLoginPage())
&& (BooleanUtils.isTrue(Config.portal().getLoginPage().getEnable()))) {
map.put(MAP_LOGINPAGE, Config.portal().getLoginPage());
} else if ((null != Config.person().getLoginPage())
&& (BooleanUtils.isTrue(Config.person().getLoginPage().getEnable()))) {
map.put(MAP_LOGINPAGE, Config.person().getLoginPage());
} else {
map.put(MAP_LOGINPAGE, Config.portal().getLoginPage());
}
map.put("indexPage", Config.portal().getIndexPage());
map.put("webSocketEnable", Config.communicate().wsEnable());
map.put("urlMapping", Config.portal().getUrlMapping());
/* 密码规则 */
map.put("passwordRegex", Config.person().getPasswordRegex());
map.put("passwordRegexHint", Config.person().getPasswordRegexHint());
/* RSA */
File publicKeyFile = new File(Config.base(), "config/public.key");
if (publicKeyFile.exists() && publicKeyFile.isFile()) {
String publicKey = FileUtils.readFileToString(publicKeyFile, "utf-8");
byte[] publicKeyB = Base64.decodeBase64(publicKey);
publicKey = new String(Base64.encodeBase64(publicKeyB));
map.put("publicKey", publicKey);
}
for (Entry<String, JsonElement> en : Config.web().entrySet()) {
map.put(en.getKey(), en.getValue());
}
FileUtils.writeStringToFile(file, gson.toJson(map), DefaultCharset.charset);
/** 写入systemName */
map.put("footer", Config.collect().getFooter());
map.put("title", Config.collect().getTitle());
map.put("appUrl", Config.collect().getAppUrl());
/***/
if (centerServerConfig.getSslEnable()) {
map.put("app_protocol", "https:");
} else {
map.put("app_protocol", "http:");
}
/* 上面的无效 */
map.put("app_protocol", "auto");
if ((null != Config.portal().getLoginPage())
&& (BooleanUtils.isTrue(Config.portal().getLoginPage().getEnable()))) {
map.put(MAP_LOGINPAGE, Config.portal().getLoginPage());
} else if ((null != Config.person().getLoginPage())
&& (BooleanUtils.isTrue(Config.person().getLoginPage().getEnable()))) {
map.put(MAP_LOGINPAGE, Config.person().getLoginPage());
} else {
map.put(MAP_LOGINPAGE, Config.portal().getLoginPage());
}
map.put("indexPage", Config.portal().getIndexPage());
map.put("webSocketEnable", Config.communicate().wsEnable());
map.put("urlMapping", Config.portal().getUrlMapping());
/* 密码规则 */
map.put("passwordRegex", Config.person().getPasswordRegex());
map.put("passwordRegexHint", Config.person().getPasswordRegexHint());
/* RSA */
File publicKeyFile = new File(Config.base(), "config/public.key");
if (publicKeyFile.exists() && publicKeyFile.isFile()) {
String publicKey = FileUtils.readFileToString(publicKeyFile, "utf-8");
byte[] publicKeyB = Base64.decodeBase64(publicKey);
publicKey = new String(Base64.encodeBase64(publicKeyB));
map.put("publicKey", publicKey);
}
for (Entry<String, JsonElement> en : Config.web().entrySet()) {
map.put(en.getKey(), en.getValue());
}
FileUtils.writeStringToFile(file, gson.toJson(map), DefaultCharset.charset);
}
private static void createIndexPage() throws Exception {
......@@ -300,4 +297,4 @@ public class WebServerTools extends JettySeverTools {
FileUtils.copyDirectory(p.toFile(), Config.path_servers_webServer(true).toFile());
}
}
}
\ No newline at end of file
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册