diff --git a/services/git-bridge/README.md b/services/git-bridge/README.md index 1ab77cbf39..c43a537752 100644 --- a/services/git-bridge/README.md +++ b/services/git-bridge/README.md @@ -32,11 +32,8 @@ The configuration file is in `.json` format. There is an example at `bin/config. "apiBaseUrl" (string): base url for the snapshot api, "username" (string, optional): username for http basic auth, "password" (string, optional): password for http basic auth, - "serviceName" (string): current name of writeLaTeX in case it ever changes, - "hostname": (string): the public hostname of the server, for postback, - "ssl": { (object): ssl configuration - "enabled": (boolean): decides on http or https for the postback url - } + "postbackUrl" (string): the postback url, + "serviceName" (string): current name of writeLaTeX in case it ever changes } You have to restart the server for configuration changes to take effect. diff --git a/services/git-bridge/bin/config.json b/services/git-bridge/bin/config.json index 5649ba2e0c..155e00b005 100644 --- a/services/git-bridge/bin/config.json +++ b/services/git-bridge/bin/config.json @@ -4,9 +4,6 @@ "apiBaseUrl": "https://radiant-wind-3058.herokuapp.com/api/v0", "username": "staging", "password": "6kUfbv0R", - "serviceName": "Overleaf", - "hostname": "git.overleaf.com", - "ssl": { - "enabled": false - } + "postbackUrl": "http://git.overleaf.com", + "serviceName": "Overleaf" } diff --git a/services/git-bridge/src/uk/ac/ic/wlgitbridge/application/Config.java b/services/git-bridge/src/uk/ac/ic/wlgitbridge/application/Config.java index 75d118c5cb..be346c8875 100644 --- a/services/git-bridge/src/uk/ac/ic/wlgitbridge/application/Config.java +++ b/services/git-bridge/src/uk/ac/ic/wlgitbridge/application/Config.java @@ -20,9 +20,8 @@ public class Config implements JSONSource { private String username; private String password; private String apiBaseURL; + private String postbackURL; private String serviceName; - private String hostname; - private SSLConfig ssl; public Config(String configFilePath) throws InvalidConfigFileException, IOException { try { @@ -45,8 +44,10 @@ public class Config implements JSONSource { } this.apiBaseURL = apiBaseURL; serviceName = getElement(configObject, "serviceName").getAsString(); - hostname = getOptionalString(configObject, "hostname"); - ssl = new SSLConfig(getElement(configObject, "ssl").getAsJsonObject()); + postbackURL = getElement(configObject, "postbackUrl").getAsString(); + if (!postbackURL.endsWith("/")) { + postbackURL += "/"; + } } public int getPort() { @@ -89,12 +90,8 @@ public class Config implements JSONSource { return serviceName; } - public String getHostname() { - return hostname; - } - - public SSLConfig getSSL() { - return ssl; + public String getPostbackURL() { + return postbackURL; } } diff --git a/services/git-bridge/src/uk/ac/ic/wlgitbridge/application/WLGitBridgeServer.java b/services/git-bridge/src/uk/ac/ic/wlgitbridge/application/WLGitBridgeServer.java index 88745e9771..2f8a9716c1 100644 --- a/services/git-bridge/src/uk/ac/ic/wlgitbridge/application/WLGitBridgeServer.java +++ b/services/git-bridge/src/uk/ac/ic/wlgitbridge/application/WLGitBridgeServer.java @@ -54,8 +54,7 @@ public class WLGitBridgeServer { writeLatexHostname = config.getAPIBaseURL(); SnapshotAPIRequest.setBaseURL(writeLatexHostname); Util.setServiceName(config.getServiceName()); - Util.setHostname(config.getHostname()); - Util.setSSL(config.getSSL()); + Util.setPostbackURL(config.getPostbackURL()); Util.setPort(config.getPort()); } @@ -67,10 +66,9 @@ public class WLGitBridgeServer { jettyServer.start(); System.out.println(); System.out.println(Util.getServiceName() + "-Git Bridge server started"); - System.out.println("Hostname: " + Util.getHostname()); System.out.println("Listening on port: " + port); - System.out.println("SSL enabled: " + Util.getSSLConfig().isEnabled()); System.out.println("Bridged to: " + writeLatexHostname); + System.out.println("Postback URL: " + Util.getPostbackURL()); System.out.println("Root git directory path: " + rootGitDirectoryPath); } catch (BindException e) { e.printStackTrace(); diff --git a/services/git-bridge/src/uk/ac/ic/wlgitbridge/git/handler/WLReceivePackFactory.java b/services/git-bridge/src/uk/ac/ic/wlgitbridge/git/handler/WLReceivePackFactory.java index c68a01d7c7..d78d3d4906 100644 --- a/services/git-bridge/src/uk/ac/ic/wlgitbridge/git/handler/WLReceivePackFactory.java +++ b/services/git-bridge/src/uk/ac/ic/wlgitbridge/git/handler/WLReceivePackFactory.java @@ -26,7 +26,7 @@ public class WLReceivePackFactory implements ReceivePackFactory