[FEATURE] Support properties in ServerWrapper

This commit is contained in:
Gravita 2023-09-21 22:08:03 +07:00
parent 58d8ba2358
commit e12f2ef897

View file

@ -128,6 +128,11 @@ public void run(String... args) throws Throwable {
LogHelper.error(e); LogHelper.error(e);
} }
}; };
if(config.properties != null) {
for(Map.Entry<String, String> e : config.properties.entrySet()) {
System.setProperty(e.getKey(), e.getValue());
}
}
Request.setRequestService(service); Request.setRequestService(service);
if (config.logFile != null) LogHelper.addOutput(IOHelper.newWriter(Paths.get(config.logFile), true)); if (config.logFile != null) LogHelper.addOutput(IOHelper.newWriter(Paths.get(config.logFile), true));
{ {
@ -213,6 +218,7 @@ public Config getDefaultConfig() {
newConfig.address = "ws://localhost:9274/api"; newConfig.address = "ws://localhost:9274/api";
newConfig.classLoaderConfig = ClientProfile.ClassLoaderConfig.SYSTEM_ARGS; newConfig.classLoaderConfig = ClientProfile.ClassLoaderConfig.SYSTEM_ARGS;
newConfig.env = LauncherConfig.LauncherEnvironment.STD; newConfig.env = LauncherConfig.LauncherEnvironment.STD;
newConfig.properties = new HashMap<>();
return newConfig; return newConfig;
} }
@ -238,6 +244,8 @@ public static final class Config {
public byte[] encodedServerRsaPublicKey; public byte[] encodedServerRsaPublicKey;
public byte[] encodedServerEcPublicKey; public byte[] encodedServerEcPublicKey;
public Map<String, String> properties;
} }
public static final class ModuleConf { public static final class ModuleConf {