Permalink
Browse files

Fix to the pydiocaddy generation

  • Loading branch information...
1 parent d8402f5 commit 3a97386052255c08e8237034377a3ef7bfa8cc42 @ghecquet ghecquet committed Aug 24, 2016
Showing with 42 additions and 33 deletions.
  1. +42 −33 core/src/plugins/core.mq/MqManager.php
@@ -503,41 +503,50 @@ public function generateCaddyFile($params) {
$authURL = $serverURL . "/api/pydio/ws_authenticate?key=" . $configs["WS_SERVER_ADMIN"];
// Websocket Server Config
- $host = $params["WS_HOST"];
- $port = $params["WS_PORT"];
- $secure = $params["WS_SECURE"];
- $path = "/" . trim($params["WS_PATH"], "/");
-
- $key = "http" . ($secure ? "s" : "") . "://" . $host . ":" . $port;
- $hosts[$key] = array_merge(
- (array) $hosts[$key],
- [
- "pydioauth" => [$path, $authURL, $tokenURL. "&device=websocket"],
- "pydiows" => [$path]
- ]
- );
+ $active = $params["WS_ACTIVE"];
+
+ if ($active) {
+ $host = $params["WS_HOST"];
+ $port = $params["WS_PORT"];
+ $secure = $params["WS_SECURE"];
+ $path = "/" . trim($params["WS_PATH"], "/");
+
+ $key = "http" . ($secure ? "s" : "") . "://" . $host . ":" . $port;
+ $hosts[$key] = array_merge(
+ (array)$hosts[$key],
+ [
+ "pydioauth" => [$path, $authURL, $tokenURL . "&device=websocket"],
+ "pydiows" => [$path]
+ ]
+ );
+ }
// Upload Server Config
- $host = $params["UPLOAD_HOST"];
- $port = $params["UPLOAD_PORT"];
- $secure = $params["UPLOAD_SECURE"];
- $path = "/" . trim($params["UPLOAD_PATH"], "/");
-
- $key = "http" . ($secure ? "s" : "") . "://" . $host . ":" . $port;
- $hosts[$key] = array_merge(
- (array) $hosts[$key],
- [
- "header" => [$path, "{\n" .
- "\tAccess-Control-Allow-Origin ". $serverURL ."\n" .
- "\tAccess-Control-Request-Headers *\n" .
- "\tAccess-Control-Allow-Methods POST\n" .
- "\tAccess-Control-Allow-Headers Range\n" .
- "\tAccess-Control-Allow-Credentials true\n" .
- "}"
- ],
- "pydioupload" => [$path, $tokenURL . "&device=upload"]
- ]
- );
+ $active = $params["UPLOAD_ACTIVE"];
+
+ if ($active) {
+ $host = $params["UPLOAD_HOST"];
+ $port = $params["UPLOAD_PORT"];
+ $secure = $params["UPLOAD_SECURE"];
+ $path = "/" . trim($params["UPLOAD_PATH"], "/");
+
+ $key = "http" . ($secure ? "s" : "") . "://" . $host . ":" . $port;
+ $hosts[$key] = array_merge(
+ (array)$hosts[$key],
+ [
+ "header" => [$path, "{\n" .
+ "\tAccess-Control-Allow-Origin " . $serverURL . "\n" .
+ "\tAccess-Control-Request-Headers *\n" .
+ "\tAccess-Control-Allow-Methods POST\n" .
+ "\tAccess-Control-Allow-Headers Range\n" .
+ "\tAccess-Control-Allow-Credentials true\n" .
+ "}"
+ ],
+ "pydioauth" => [$path, $authURL, $tokenURL . "&device=upload"],
+ "pydioupload" => [$path]
+ ]
+ );
+ }
foreach ($hosts as $host => $config) {
$data .= $host . " {\n";

0 comments on commit 3a97386

Please sign in to comment.