client: allow setting system properties via runtime config
This commit is contained in:
@@ -44,6 +44,7 @@ import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Stream;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -145,6 +146,10 @@ public class RuneLite
|
||||
@Nullable
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
@Nullable
|
||||
private RuntimeConfig runtimeConfig;
|
||||
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
Locale.setDefault(Locale.ENGLISH);
|
||||
@@ -287,6 +292,8 @@ public class RuneLite
|
||||
injector.injectMembers(client);
|
||||
}
|
||||
|
||||
setupSystemProps();
|
||||
|
||||
// Start the applet
|
||||
if (applet != null)
|
||||
{
|
||||
@@ -514,4 +521,19 @@ public class RuneLite
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,4 +32,5 @@ import lombok.Data;
|
||||
public class RuntimeConfig
|
||||
{
|
||||
private Map<String, ?> props = Collections.emptyMap();
|
||||
private Map<String, String> sysProps = Collections.emptyMap();
|
||||
}
|
||||
Reference in New Issue
Block a user