Răsfoiți Sursa

Changed hostname to apiBaseUrl.

Winston Li 12 ani în urmă
părinte
comite
f8c311688d

+ 1 - 1
services/git-bridge/bin/config.json

@@ -2,7 +2,7 @@
 	"port": 80,
 	"rootGitDirectory": "/var/wlgb/git",
 	"apiKey": "",
-	"hostname": "https://radiant-wind-3058.herokuapp.com/",
+	"apiBaseUrl": "https://radiant-wind-3058.herokuapp.com/api/v0",
 	"username": "staging",
 	"password": "6kUfbv0R",
 	"serviceName": "WriteLatex"

+ 7 - 7
services/git-bridge/src/uk/ac/ic/wlgitbridge/application/Config.java

@@ -20,7 +20,7 @@ public class Config implements JSONSource {
     private String apiKey;
     private String username;
     private String password;
-    private String hostname;
+    private String apiBaseURL;
     private String serviceName;
 
     public Config(String configFilePath) throws InvalidConfigFileException, IOException {
@@ -39,11 +39,11 @@ public class Config implements JSONSource {
         apiKey = getElement(configObject, "apiKey").getAsString();
         username = getOptionalString(configObject, "username");
         password = getOptionalString(configObject, "password");
-        String hostname = getElement(configObject, "hostname").getAsString();
-        if (!hostname.endsWith("/")) {
-            hostname += "/";
+        String apiBaseURL = getElement(configObject, "apiBaseUrl").getAsString();
+        if (!apiBaseURL.endsWith("/")) {
+            apiBaseURL += "/";
         }
-        this.hostname = hostname;
+        this.apiBaseURL = apiBaseURL;
         serviceName = getElement(configObject, "serviceName").getAsString();
     }
 
@@ -67,8 +67,8 @@ public class Config implements JSONSource {
         return password;
     }
 
-    public String getHostname() {
-        return hostname;
+    public String getAPIBaseURL() {
+        return apiBaseURL;
     }
 
     private JsonElement getElement(JsonObject configObject, String name) {

+ 1 - 1
services/git-bridge/src/uk/ac/ic/wlgitbridge/application/WLGitBridgeServer.java

@@ -52,7 +52,7 @@ public class WLGitBridgeServer {
     public WLGitBridgeServer(Config config) throws ServletException, InvalidRootDirectoryPathException {
         this(config.getPort(), config.getRootGitDirectory(), config.getAPIKey());
         SnapshotAPIRequest.setBasicAuth(config.getUsername(), config.getPassword());
-        writeLatexHostname = config.getHostname();
+        writeLatexHostname = config.getAPIBaseURL();
         SnapshotAPIRequest.setBaseURL(writeLatexHostname);
         Util.setServiceName(config.getServiceName());
     }

+ 2 - 2
services/git-bridge/src/uk/ac/ic/wlgitbridge/writelatex/api/request/base/SnapshotAPIRequest.java

@@ -10,7 +10,6 @@ public abstract class SnapshotAPIRequest<T extends Result> extends Request<T> {
     private static String USERNAME;
     private static String PASSWORD;
 
-    /* Must end with / */
     private static String BASE_URL;
 
     public SnapshotAPIRequest(String projectName, String apiCall) {
@@ -31,8 +30,9 @@ public abstract class SnapshotAPIRequest<T extends Result> extends Request<T> {
         PASSWORD = password;
     }
 
+    /* baseURL ends with / */
     public static void setBaseURL(String baseURL) {
-        BASE_URL = baseURL;
+        BASE_URL = baseURL + "/docs/";
     }
 
 }