Преглед на файлове

Use environment protocol and host to display webhook url

jnfrati преди 5 години
родител
ревизия
815d59e5d8
променени са 1 файла, в които са добавени 5 реда и са изтрити 1 реда
  1. 5 1
      dashboard/src/main/home/cluster-dashboard/expanded-chart/SettingsSection.tsx

+ 5 - 1
dashboard/src/main/home/cluster-dashboard/expanded-chart/SettingsSection.tsx

@@ -185,7 +185,11 @@ const SettingsSection: React.FC<PropsType> = ({
       return;
     }
 
-    const curlWebhook = `curl -X POST 'https://dashboard.getporter.dev/api/webhooks/deploy/${webhookToken}?commit=YOUR_COMMIT_HASH'`;
+    const protocol = window.location.protocol == "https:" ? "https" : "http";
+
+    const url = `${protocol}://${window.location.host}`;
+
+    const curlWebhook = `curl -X POST '${url}/api/webhooks/deploy/${webhookToken}?commit=YOUR_COMMIT_HASH'`;
 
     const isAuthorizedToCreateWebhook = isAuthorized("application", "", [
       "get",