From e4cd2bb0b9f7375a6d803e8b324f0726ddc609bb Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Tue, 5 Mar 2019 08:30:01 +0100 Subject: [PATCH] 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 --- .../net/runelite/http/api/RuneLiteAPI.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/http-api/src/main/java/net/runelite/http/api/RuneLiteAPI.java b/http-api/src/main/java/net/runelite/http/api/RuneLiteAPI.java index 65aeab39f1..472c241f72 100644 --- a/http-api/src/main/java/net/runelite/http/api/RuneLiteAPI.java +++ b/http-api/src/main/java/net/runelite/http/api/RuneLiteAPI.java @@ -97,21 +97,49 @@ public class RuneLiteAPI 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"); } 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()); } 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); } 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); }