]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Automatically use the correct path for Conduit URIs in arc
authorepriestley <git@epriestley.com>
Thu, 23 Jun 2011 20:10:51 +0000 (13:10 -0700)
committerepriestley <git@epriestley.com>
Fri, 24 Jun 2011 00:26:08 +0000 (17:26 -0700)
Summary:
Right now, if you specify "/api" instead of "/api/" the entire world breaks in a
horrible way. Generally, this whole thing is silly. Just use the right path.

Test Plan:
Edited .arcconfig to use the "wrong" path, so this diff demonstrates the change
works.

Reviewed By: llorca
Reviewers: jungejason, llorca, aran, tuomaspelkonen
CC: aran, llorca, epriestley
Differential Revision: 506

.arcconfig
scripts/arcanist.php

index de02caaaa28ac3993f02214813dd0ca34972f2b3..cc74a857d114c30c8708cb76a6fb8b8abd970a53 100644 (file)
@@ -1,6 +1,6 @@
 {
   "project_id" : "arcanist",
-  "conduit_uri" : "https://secure.phabricator.com/api/",
+  "conduit_uri" : "https://secure.phabricator.com/",
   "lint_engine" : "PhutilLintEngine",
   "unit_engine" : "PhutilUnitTestEngine",
   "remote_hooks_installed" : true,
index 76f56638b8bf88c8eaefc17b6b857c56dc04d600..5612b749ce7c1ed268fe610a6f3fc62a7c24eefd 100755 (executable)
@@ -173,6 +173,15 @@ try {
       throw new ArcanistUsageException(
         "No Conduit URI is specified in the .arcconfig file for this project. ".
         "Specify the Conduit URI for the host Differential is running on.");
+    } else {
+      // Set the URI path to '/api/'. TODO: Originally, I contemplated letting
+      // you deploy Phabricator somewhere other than the domain root, but ended
+      // up never pursuing that. We should get rid of all "/api/" silliness
+      // in things users are expected to configure. This is already happening
+      // to some degree, e.g. "arc install-certificate" does it for you.
+      $conduit_uri = new PhutilURI($conduit_uri);
+      $conduit_uri->setPath('/api/');
+      $conduit_uri = (string)$conduit_uri;
     }
     $conduit = new ConduitClient($conduit_uri);
     $workflow->setConduit($conduit);