Support specifying API endpoins via java props

- Add support fo specifying runelite.session.url java prop to be used
instead of RuneLite session base
- Add support fo specifying runelite.http-service.url java prop to be used
instead of RuneLite api base url
- Add support fo specifying runelite.ws.url java prop to be used
instead of RuneLite websocket url
- Add support for specifying runelite.static.url java prop to be used
instead of RuneLite s.r.n url

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2019-03-05 08:30:01 +01:00
parent 6071592e57
commit e4cd2bb0b9

View File

@@ -97,21 +97,49 @@ public class RuneLiteAPI
public static HttpUrl getSessionBase() public static HttpUrl getSessionBase()
{ {
final String prop = System.getProperty("runelite.session.url");
if (prop != null && !prop.isEmpty())
{
return HttpUrl.parse(prop);
}
return HttpUrl.parse(BASE + "/session"); return HttpUrl.parse(BASE + "/session");
} }
public static HttpUrl getApiBase() public static HttpUrl getApiBase()
{ {
final String prop = System.getProperty("runelite.http-service.url");
if (prop != null && !prop.isEmpty())
{
return HttpUrl.parse(prop);
}
return HttpUrl.parse(BASE + "/runelite-" + getVersion()); return HttpUrl.parse(BASE + "/runelite-" + getVersion());
} }
public static HttpUrl getStaticBase() public static HttpUrl getStaticBase()
{ {
final String prop = System.getProperty("runelite.static.url");
if (prop != null && !prop.isEmpty())
{
return HttpUrl.parse(prop);
}
return HttpUrl.parse(STATICBASE); return HttpUrl.parse(STATICBASE);
} }
public static HttpUrl getWsEndpoint() public static HttpUrl getWsEndpoint()
{ {
final String prop = System.getProperty("runelite.ws.url");
if (prop != null && !prop.isEmpty())
{
return HttpUrl.parse(prop);
}
return HttpUrl.parse(WSBASE); return HttpUrl.parse(WSBASE);
} }