mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 20:27:12 +00:00
Begin Netlify integration
This commit is contained in:
@@ -13,8 +13,10 @@ import {
|
|||||||
INTEGRATION_OAUTH2,
|
INTEGRATION_OAUTH2,
|
||||||
INTEGRATION_HEROKU_TOKEN_URL,
|
INTEGRATION_HEROKU_TOKEN_URL,
|
||||||
INTEGRATION_VERCEL_TOKEN_URL,
|
INTEGRATION_VERCEL_TOKEN_URL,
|
||||||
|
INTEGRATION_NETLIFY_TOKEN_URL,
|
||||||
INTEGRATION_HEROKU_API_URL,
|
INTEGRATION_HEROKU_API_URL,
|
||||||
INTEGRATION_VERCEL_API_URL
|
INTEGRATION_VERCEL_API_URL,
|
||||||
|
INTEGRATION_NETLIFY_API_URL
|
||||||
} from './integration';
|
} from './integration';
|
||||||
import {
|
import {
|
||||||
OWNER,
|
OWNER,
|
||||||
@@ -65,8 +67,10 @@ export {
|
|||||||
INTEGRATION_OAUTH2,
|
INTEGRATION_OAUTH2,
|
||||||
INTEGRATION_HEROKU_TOKEN_URL,
|
INTEGRATION_HEROKU_TOKEN_URL,
|
||||||
INTEGRATION_VERCEL_TOKEN_URL,
|
INTEGRATION_VERCEL_TOKEN_URL,
|
||||||
|
INTEGRATION_NETLIFY_TOKEN_URL,
|
||||||
INTEGRATION_HEROKU_API_URL,
|
INTEGRATION_HEROKU_API_URL,
|
||||||
INTEGRATION_VERCEL_API_URL,
|
INTEGRATION_VERCEL_API_URL,
|
||||||
|
INTEGRATION_NETLIFY_API_URL,
|
||||||
EVENT_PUSH_SECRETS,
|
EVENT_PUSH_SECRETS,
|
||||||
EVENT_PULL_SECRETS,
|
EVENT_PULL_SECRETS,
|
||||||
ACTION_PUSH_TO_HEROKU
|
ACTION_PUSH_TO_HEROKU
|
||||||
|
|||||||
@@ -14,10 +14,12 @@ const INTEGRATION_OAUTH2 = 'oauth2';
|
|||||||
// integration oauth endpoints
|
// integration oauth endpoints
|
||||||
const INTEGRATION_HEROKU_TOKEN_URL = 'https://id.heroku.com/oauth/token';
|
const INTEGRATION_HEROKU_TOKEN_URL = 'https://id.heroku.com/oauth/token';
|
||||||
const INTEGRATION_VERCEL_TOKEN_URL = 'https://api.vercel.com/v2/oauth/access_token';
|
const INTEGRATION_VERCEL_TOKEN_URL = 'https://api.vercel.com/v2/oauth/access_token';
|
||||||
|
const INTEGRATION_NETLIFY_TOKEN_URL = 'https://app.netlify.com/authorize';
|
||||||
|
|
||||||
// integration apps endpoints
|
// integration apps endpoints
|
||||||
const INTEGRATION_HEROKU_API_URL = 'https://api.heroku.com';
|
const INTEGRATION_HEROKU_API_URL = 'https://api.heroku.com';
|
||||||
const INTEGRATION_VERCEL_API_URL = 'https://api.vercel.com';
|
const INTEGRATION_VERCEL_API_URL = 'https://api.vercel.com';
|
||||||
|
const INTEGRATION_NETLIFY_API_URL = 'https://api.netlify.com';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
INTEGRATION_HEROKU,
|
INTEGRATION_HEROKU,
|
||||||
@@ -27,6 +29,8 @@ export {
|
|||||||
INTEGRATION_OAUTH2,
|
INTEGRATION_OAUTH2,
|
||||||
INTEGRATION_HEROKU_TOKEN_URL,
|
INTEGRATION_HEROKU_TOKEN_URL,
|
||||||
INTEGRATION_VERCEL_TOKEN_URL,
|
INTEGRATION_VERCEL_TOKEN_URL,
|
||||||
|
INTEGRATION_NETLIFY_TOKEN_URL,
|
||||||
INTEGRATION_HEROKU_API_URL,
|
INTEGRATION_HEROKU_API_URL,
|
||||||
INTEGRATION_VERCEL_API_URL,
|
INTEGRATION_VERCEL_API_URL,
|
||||||
|
INTEGRATION_NETLIFY_API_URL,
|
||||||
}
|
}
|
||||||
@@ -125,9 +125,11 @@ export default function Integrations() {
|
|||||||
window.location = `https://id.heroku.com/oauth/authorize?client_id=${integrationOption.clientId}&response_type=code&scope=write-protected&state=${csrfToken}`;
|
window.location = `https://id.heroku.com/oauth/authorize?client_id=${integrationOption.clientId}&response_type=code&scope=write-protected&state=${csrfToken}`;
|
||||||
break;
|
break;
|
||||||
case 'Vercel':
|
case 'Vercel':
|
||||||
console.log('Vercel integration ', integrationOption);
|
|
||||||
window.location = `https://vercel.com/integrations/infisical/new?state=${csrfToken}`;
|
window.location = `https://vercel.com/integrations/infisical/new?state=${csrfToken}`;
|
||||||
break;
|
break;
|
||||||
|
case 'Netlify':
|
||||||
|
console.log('netlifyyy');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import React, { useEffect } from "react";
|
||||||
|
import Head from "next/head";
|
||||||
|
import { useRouter } from "next/router";
|
||||||
|
const queryString = require("query-string");
|
||||||
|
import AuthorizeIntegration from "./api/integrations/authorizeIntegration";
|
||||||
|
|
||||||
|
export default function Netlify() {
|
||||||
|
const router = useRouter();
|
||||||
|
const parsedUrl = queryString.parse(router.asPath.split("?")[1]);
|
||||||
|
// modify comment here
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Here we forward to the default workspace if a user opens this url
|
||||||
|
*/
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
useEffect(async () => {
|
||||||
|
if (state === localStorage.getItem('latestCSRFToken')) {
|
||||||
|
localStorage.removeItem('latestCSRFToken');
|
||||||
|
|
||||||
|
console.log('Netlify', parsedUrl);
|
||||||
|
|
||||||
|
// await AuthorizeIntegration({
|
||||||
|
// workspaceId: localStorage.getItem('projectData.id'),
|
||||||
|
// code,
|
||||||
|
// integration: "vercel"
|
||||||
|
// });
|
||||||
|
|
||||||
|
// router.push("/integrations/" + localStorage.getItem("projectData.id"));
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Netlify integration error: ', err);
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return <div></div>;
|
||||||
|
}
|
||||||
|
|
||||||
|
Netlify.requireAuth = true;
|
||||||
@@ -10,21 +10,14 @@ export default function Vercel() {
|
|||||||
const code = parsedUrl.code;
|
const code = parsedUrl.code;
|
||||||
const state = parsedUrl.state
|
const state = parsedUrl.state
|
||||||
|
|
||||||
// modify comment here
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Here we forward to the default workspace if a user opens this url
|
* Here we forward to the default workspace if a user opens this url
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
useEffect(async () => {
|
useEffect(async () => {
|
||||||
console.log('parsedUrl for vercel ', parsedUrl);
|
|
||||||
if (state === localStorage.getItem('latestCSRFToken')) {
|
if (state === localStorage.getItem('latestCSRFToken')) {
|
||||||
localStorage.removeItem('latestCSRFToken');
|
localStorage.removeItem('latestCSRFToken');
|
||||||
|
|
||||||
console.log('integ');
|
|
||||||
console.log('code', code);
|
|
||||||
console.log('state', state);
|
|
||||||
|
|
||||||
await AuthorizeIntegration({
|
await AuthorizeIntegration({
|
||||||
workspaceId: localStorage.getItem('projectData.id'),
|
workspaceId: localStorage.getItem('projectData.id'),
|
||||||
code,
|
code,
|
||||||
@@ -33,10 +26,7 @@ export default function Vercel() {
|
|||||||
|
|
||||||
router.push("/integrations/" + localStorage.getItem("projectData.id"));
|
router.push("/integrations/" + localStorage.getItem("projectData.id"));
|
||||||
}
|
}
|
||||||
// parsedUrl.code
|
|
||||||
// parsedUrl.configurationId
|
|
||||||
// parsedUrl.next
|
|
||||||
// parsedUrl.state
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
@@ -9,18 +9,18 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Vercel",
|
"name": "Vercel",
|
||||||
"slug": "netlify",
|
"slug": "vercel",
|
||||||
"image": "Netlify",
|
"image": "Vercel",
|
||||||
"isAvailable": true,
|
"isAvailable": true,
|
||||||
"type": "vercel",
|
"type": "vercel",
|
||||||
"clientId": ""
|
"clientId": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Digital Ocean",
|
"name": "Netlify",
|
||||||
"slug": "digital-ocean",
|
"slug": "netlify",
|
||||||
"image": "Digital Ocean",
|
"image": "Netlify",
|
||||||
"isAvailable": false,
|
"isAvailable": true,
|
||||||
"type": "",
|
"type": "oauth2",
|
||||||
"clientId": ""
|
"clientId": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user