client: allow setting system properties via runtime config

This commit is contained in:
Adam
2022-03-15 17:03:14 -04:00
parent dbfcc456f9
commit 2192ac7d45
2 changed files with 23 additions and 0 deletions

View File

@@ -44,6 +44,7 @@ import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
import java.util.Locale; import java.util.Locale;
import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Stream; import java.util.stream.Stream;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -145,6 +146,10 @@ public class RuneLite
@Nullable @Nullable
private Client client; private Client client;
@Inject
@Nullable
private RuntimeConfig runtimeConfig;
public static void main(String[] args) throws Exception public static void main(String[] args) throws Exception
{ {
Locale.setDefault(Locale.ENGLISH); Locale.setDefault(Locale.ENGLISH);
@@ -287,6 +292,8 @@ public class RuneLite
injector.injectMembers(client); injector.injectMembers(client);
} }
setupSystemProps();
// Start the applet // Start the applet
if (applet != null) if (applet != null)
{ {
@@ -514,4 +521,19 @@ public class RuneLite
log.warn("unable to copy jagexcache", e); log.warn("unable to copy jagexcache", e);
} }
} }
private void setupSystemProps()
{
if (runtimeConfig == null || runtimeConfig.getSysProps() == null)
{
return;
}
for (Map.Entry<String, String> entry : runtimeConfig.getSysProps().entrySet())
{
String key = entry.getKey(), value = entry.getValue();
log.debug("Setting property {}={}", key, value);
System.setProperty(key, value);
}
}
} }

View File

@@ -32,4 +32,5 @@ import lombok.Data;
public class RuntimeConfig public class RuntimeConfig
{ {
private Map<String, ?> props = Collections.emptyMap(); private Map<String, ?> props = Collections.emptyMap();
private Map<String, String> sysProps = Collections.emptyMap();
} }