Procházet zdrojové kódy

Use environment protocol and host to display webhook url

jnfrati před 4 roky
rodič
revize
815d59e5d8

+ 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",