Add API url override

This commit is contained in:
2024-06-27 00:51:04 +02:00
parent 086e6d11a6
commit dab1cbde07
2 changed files with 17 additions and 1 deletions

View File

@@ -41,6 +41,14 @@ public class NightBloom4J {
return new NightBloom4J(httpClient);
}
/**
* Override the API url used by the HTTP client
* @param url The new URL to use
*/
public void setUrl(String url) {
this.getClient().setBaseUrl(url);
}
/**
* API Endpoints for interacting with Projects
* @return A {@link ProjectsEndpoint} endpoint client for executing project requests

View File

@@ -17,7 +17,7 @@ import java.io.IOException;
public abstract class HttpClient {
// Private variables, mostly for internal use
private final String API_BASE = "http://127.0.0.1:8787";
private String API_BASE = "https://api.nightbloom.cc";
private final String baseUrl;
private final UserAgent agent;
@@ -140,4 +140,12 @@ public abstract class HttpClient {
}
}
}
/**
* Override the API url for the platform
* @param url The new API url to use
*/
public void setBaseUrl(String url) {
this.API_BASE = url;
}
}