mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-09 00:28:12 +00:00
Move CLIENT_ID envars to be fetched from backend for (cloud) integration options
This commit is contained in:
@@ -11,6 +11,7 @@ const JWT_SIGNUP_SECRET = process.env.JWT_SIGNUP_SECRET!;
|
|||||||
const MONGO_URL = process.env.MONGO_URL!;
|
const MONGO_URL = process.env.MONGO_URL!;
|
||||||
const NODE_ENV = process.env.NODE_ENV! || 'production';
|
const NODE_ENV = process.env.NODE_ENV! || 'production';
|
||||||
const CLIENT_SECRET_HEROKU = process.env.CLIENT_SECRET_HEROKU!;
|
const CLIENT_SECRET_HEROKU = process.env.CLIENT_SECRET_HEROKU!;
|
||||||
|
const CLIENT_ID_HEROKU = process.env.CLIENT_ID_HEROKU!;
|
||||||
const CLIENT_ID_VERCEL = process.env.CLIENT_ID_VERCEL!;
|
const CLIENT_ID_VERCEL = process.env.CLIENT_ID_VERCEL!;
|
||||||
const CLIENT_ID_NETLIFY = process.env.CLIENT_ID_NETLIFY!;
|
const CLIENT_ID_NETLIFY = process.env.CLIENT_ID_NETLIFY!;
|
||||||
const CLIENT_SECRET_VERCEL = process.env.CLIENT_SECRET_VERCEL!;
|
const CLIENT_SECRET_VERCEL = process.env.CLIENT_SECRET_VERCEL!;
|
||||||
@@ -49,6 +50,7 @@ export {
|
|||||||
JWT_SIGNUP_SECRET,
|
JWT_SIGNUP_SECRET,
|
||||||
MONGO_URL,
|
MONGO_URL,
|
||||||
NODE_ENV,
|
NODE_ENV,
|
||||||
|
CLIENT_ID_HEROKU,
|
||||||
CLIENT_ID_VERCEL,
|
CLIENT_ID_VERCEL,
|
||||||
CLIENT_ID_NETLIFY,
|
CLIENT_ID_NETLIFY,
|
||||||
CLIENT_SECRET_HEROKU,
|
CLIENT_SECRET_HEROKU,
|
||||||
|
|||||||
@@ -3,10 +3,19 @@ import * as Sentry from '@sentry/node';
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { readFileSync } from 'fs';
|
import { readFileSync } from 'fs';
|
||||||
import { IntegrationAuth, Integration } from '../models';
|
import { IntegrationAuth, Integration } from '../models';
|
||||||
import { INTEGRATION_SET, ENV_DEV } from '../variables';
|
import { INTEGRATION_SET, INTEGRATION_OPTIONS, ENV_DEV } from '../variables';
|
||||||
import { IntegrationService } from '../services';
|
import { IntegrationService } from '../services';
|
||||||
import { getApps, revokeAccess } from '../integrations';
|
import { getApps, revokeAccess } from '../integrations';
|
||||||
|
|
||||||
|
export const getIntegrationOptions = async (
|
||||||
|
req: Request,
|
||||||
|
res: Response
|
||||||
|
) => {
|
||||||
|
return res.status(200).send({
|
||||||
|
integrationOptions: INTEGRATION_OPTIONS
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform OAuth2 code-token exchange as part of integration [integration] for workspace with id [workspaceId]
|
* Perform OAuth2 code-token exchange as part of integration [integration] for workspace with id [workspaceId]
|
||||||
* @param req
|
* @param req
|
||||||
|
|||||||
@@ -10,6 +10,12 @@ import {
|
|||||||
import { ADMIN, MEMBER, GRANTED } from '../variables';
|
import { ADMIN, MEMBER, GRANTED } from '../variables';
|
||||||
import { integrationAuthController } from '../controllers';
|
import { integrationAuthController } from '../controllers';
|
||||||
|
|
||||||
|
router.get(
|
||||||
|
'/integration-options',
|
||||||
|
requireAuth,
|
||||||
|
integrationAuthController.getIntegrationOptions
|
||||||
|
);
|
||||||
|
|
||||||
router.post(
|
router.post(
|
||||||
'/oauth-token',
|
'/oauth-token',
|
||||||
requireAuth,
|
requireAuth,
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ import {
|
|||||||
INTEGRATION_NETLIFY_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
|
INTEGRATION_NETLIFY_API_URL,
|
||||||
|
INTEGRATION_OPTIONS
|
||||||
} from './integration';
|
} from './integration';
|
||||||
import {
|
import {
|
||||||
OWNER,
|
OWNER,
|
||||||
@@ -73,5 +74,6 @@ export {
|
|||||||
INTEGRATION_NETLIFY_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,
|
||||||
|
INTEGRATION_OPTIONS
|
||||||
};
|
};
|
||||||
@@ -1,3 +1,8 @@
|
|||||||
|
import {
|
||||||
|
CLIENT_ID_HEROKU,
|
||||||
|
CLIENT_ID_NETLIFY
|
||||||
|
} from '../config';
|
||||||
|
|
||||||
// integrations
|
// integrations
|
||||||
const INTEGRATION_HEROKU = 'heroku';
|
const INTEGRATION_HEROKU = 'heroku';
|
||||||
const INTEGRATION_VERCEL = 'vercel';
|
const INTEGRATION_VERCEL = 'vercel';
|
||||||
@@ -21,6 +26,81 @@ 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';
|
const INTEGRATION_NETLIFY_API_URL = 'https://api.netlify.com';
|
||||||
|
|
||||||
|
const INTEGRATION_OPTIONS = [
|
||||||
|
{
|
||||||
|
name: 'Heroku',
|
||||||
|
slug: 'heroku',
|
||||||
|
image: 'Heroku',
|
||||||
|
isAvailable: true,
|
||||||
|
type: 'oauth2',
|
||||||
|
clientId: CLIENT_ID_HEROKU,
|
||||||
|
docsLink: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Vercel',
|
||||||
|
slug: 'vercel',
|
||||||
|
image: 'Vercel',
|
||||||
|
isAvailable: true,
|
||||||
|
type: 'vercel',
|
||||||
|
clientId: '',
|
||||||
|
docsLink: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Netlify',
|
||||||
|
slug: 'netlify',
|
||||||
|
image: 'Netlify',
|
||||||
|
isAvailable: true,
|
||||||
|
type: 'oauth2',
|
||||||
|
clientId: CLIENT_ID_NETLIFY,
|
||||||
|
docsLink: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Google Cloud Platform',
|
||||||
|
slug: 'gcp',
|
||||||
|
image: 'Google Cloud Platform',
|
||||||
|
isAvailable: false,
|
||||||
|
type: '',
|
||||||
|
clientId: '',
|
||||||
|
docsLink: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Amazon Web Services',
|
||||||
|
slug: 'aws',
|
||||||
|
image: 'Amazon Web Services',
|
||||||
|
isAvailable: false,
|
||||||
|
type: '',
|
||||||
|
clientId: '',
|
||||||
|
docsLink: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Microsoft Azure',
|
||||||
|
slug: 'azure',
|
||||||
|
image: 'Microsoft Azure',
|
||||||
|
isAvailable: false,
|
||||||
|
type: '',
|
||||||
|
clientId: '',
|
||||||
|
docsLink: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Travis CI',
|
||||||
|
slug: 'travisci',
|
||||||
|
image: 'Travis CI',
|
||||||
|
isAvailable: false,
|
||||||
|
type: '',
|
||||||
|
clientId: '',
|
||||||
|
docsLink: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Circle CI',
|
||||||
|
slug: 'circleci',
|
||||||
|
image: 'Circle CI',
|
||||||
|
isAvailable: false,
|
||||||
|
type: '',
|
||||||
|
clientId: '',
|
||||||
|
docsLink: ''
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
export {
|
export {
|
||||||
INTEGRATION_HEROKU,
|
INTEGRATION_HEROKU,
|
||||||
INTEGRATION_VERCEL,
|
INTEGRATION_VERCEL,
|
||||||
@@ -33,4 +113,5 @@ export {
|
|||||||
INTEGRATION_HEROKU_API_URL,
|
INTEGRATION_HEROKU_API_URL,
|
||||||
INTEGRATION_VERCEL_API_URL,
|
INTEGRATION_VERCEL_API_URL,
|
||||||
INTEGRATION_NETLIFY_API_URL,
|
INTEGRATION_NETLIFY_API_URL,
|
||||||
|
INTEGRATION_OPTIONS
|
||||||
}
|
}
|
||||||
@@ -54,8 +54,6 @@ services:
|
|||||||
- INFISICAL_TELEMETRY_ENABLED=${TELEMETRY_ENABLED}
|
- INFISICAL_TELEMETRY_ENABLED=${TELEMETRY_ENABLED}
|
||||||
- NEXT_PUBLIC_STRIPE_PRODUCT_PRO=${STRIPE_PRODUCT_PRO}
|
- NEXT_PUBLIC_STRIPE_PRODUCT_PRO=${STRIPE_PRODUCT_PRO}
|
||||||
- NEXT_PUBLIC_STRIPE_PRODUCT_STARTER=${STRIPE_PRODUCT_STARTER}
|
- NEXT_PUBLIC_STRIPE_PRODUCT_STARTER=${STRIPE_PRODUCT_STARTER}
|
||||||
- NEXT_PUBLIC_CLIENT_ID_HEROKU=${CLIENT_ID_HEROKU}
|
|
||||||
- NEXT_PUBLIC_CLIENT_ID_NETLIFY=${CLIENT_ID_NETLIFY}
|
|
||||||
networks:
|
networks:
|
||||||
- infisical-dev
|
- infisical-dev
|
||||||
|
|
||||||
|
|||||||
@@ -41,8 +41,6 @@ services:
|
|||||||
- INFISICAL_TELEMETRY_ENABLED=${TELEMETRY_ENABLED}
|
- INFISICAL_TELEMETRY_ENABLED=${TELEMETRY_ENABLED}
|
||||||
- NEXT_PUBLIC_STRIPE_PRODUCT_PRO=${STRIPE_PRODUCT_PRO}
|
- NEXT_PUBLIC_STRIPE_PRODUCT_PRO=${STRIPE_PRODUCT_PRO}
|
||||||
- NEXT_PUBLIC_STRIPE_PRODUCT_STARTER=${STRIPE_PRODUCT_STARTER}
|
- NEXT_PUBLIC_STRIPE_PRODUCT_STARTER=${STRIPE_PRODUCT_STARTER}
|
||||||
- NEXT_PUBLIC_CLIENT_ID_HEROKU=${CLIENT_ID_HEROKU}
|
|
||||||
- NEXT_PUBLIC_CLIENT_ID_NETLIFY=${CLIENT_ID_NETLIFY}
|
|
||||||
networks:
|
networks:
|
||||||
- infisical
|
- infisical
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import SecurityClient from '~/utilities/SecurityClient';
|
||||||
|
|
||||||
|
const getIntegrationOptions = () => {
|
||||||
|
return SecurityClient.fetchCall(
|
||||||
|
'/api/v1/integration-auth/integration-options',
|
||||||
|
{
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
).then(async (res) => {
|
||||||
|
if (res && res.status == 200) {
|
||||||
|
return (await res.json()).integrationOptions;
|
||||||
|
} else {
|
||||||
|
console.log('Failed to get (cloud) integration options');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
export default getIntegrationOptions;
|
||||||
@@ -8,10 +8,9 @@ import FrameworkIntegrationSection from "~/components/integrations/FrameworkInte
|
|||||||
import CloudIntegrationSection from "~/components/integrations/CloudIntegrationSection";
|
import CloudIntegrationSection from "~/components/integrations/CloudIntegrationSection";
|
||||||
import IntegrationSection from "~/components/integrations/IntegrationSection";
|
import IntegrationSection from "~/components/integrations/IntegrationSection";
|
||||||
import frameworkIntegrationOptions from "../../public/json/frameworkIntegrations.json";
|
import frameworkIntegrationOptions from "../../public/json/frameworkIntegrations.json";
|
||||||
// import cloudIntegrationOptions from "../../public/json/cloudIntegrations.json";
|
|
||||||
import { cloudIntegrationOptions } from "../../public/data/cloudIntegrations";
|
|
||||||
import getWorkspaceAuthorizations from "../api/integrations/getWorkspaceAuthorizations";
|
import getWorkspaceAuthorizations from "../api/integrations/getWorkspaceAuthorizations";
|
||||||
import getWorkspaceIntegrations from "../api/integrations/getWorkspaceIntegrations";
|
import getWorkspaceIntegrations from "../api/integrations/getWorkspaceIntegrations";
|
||||||
|
import getIntegrationOptions from "../api/integrations/GetIntegrationOptions";
|
||||||
import getBot from "../api/bot/getBot";
|
import getBot from "../api/bot/getBot";
|
||||||
import setBotActiveStatus from "../api/bot/setBotActiveStatus";
|
import setBotActiveStatus from "../api/bot/setBotActiveStatus";
|
||||||
import getLatestFileKey from "../api/workspace/getLatestFileKey";
|
import getLatestFileKey from "../api/workspace/getLatestFileKey";
|
||||||
@@ -26,6 +25,7 @@ const crypto = require("crypto");
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
export default function Integrations() {
|
export default function Integrations() {
|
||||||
|
const [cloudIntegrationOptions, setCloudIntegrationOptions] = useState([]);
|
||||||
const [integrationAuths, setIntegrationAuths] = useState([]);
|
const [integrationAuths, setIntegrationAuths] = useState([]);
|
||||||
const [integrations, setIntegrations] = useState([]);
|
const [integrations, setIntegrations] = useState([]);
|
||||||
const [bot, setBot] = useState(null);
|
const [bot, setBot] = useState(null);
|
||||||
@@ -37,6 +37,11 @@ export default function Integrations() {
|
|||||||
|
|
||||||
useEffect(async () => {
|
useEffect(async () => {
|
||||||
try {
|
try {
|
||||||
|
// get cloud integration options
|
||||||
|
setCloudIntegrationOptions(
|
||||||
|
await getIntegrationOptions()
|
||||||
|
);
|
||||||
|
|
||||||
// get project integration authorizations
|
// get project integration authorizations
|
||||||
setIntegrationAuths(
|
setIntegrationAuths(
|
||||||
await getWorkspaceAuthorizations({
|
await getWorkspaceAuthorizations({
|
||||||
@@ -201,12 +206,16 @@ export default function Integrations() {
|
|||||||
handleIntegrationOption={handleIntegrationOption}
|
handleIntegrationOption={handleIntegrationOption}
|
||||||
/> */}
|
/> */}
|
||||||
<IntegrationSection integrations={integrations} />
|
<IntegrationSection integrations={integrations} />
|
||||||
<CloudIntegrationSection
|
{cloudIntegrationOptions.length > 0 ? (
|
||||||
cloudIntegrationOptions={cloudIntegrationOptions}
|
<CloudIntegrationSection
|
||||||
setSelectedIntegrationOption={setSelectedIntegrationOption}
|
cloudIntegrationOptions={cloudIntegrationOptions}
|
||||||
integrationOptionPress={integrationOptionPress}
|
setSelectedIntegrationOption={setSelectedIntegrationOption}
|
||||||
integrationAuths={integrationAuths}
|
integrationOptionPress={integrationOptionPress}
|
||||||
/>
|
integrationAuths={integrationAuths}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<div></div>
|
||||||
|
)}
|
||||||
<FrameworkIntegrationSection
|
<FrameworkIntegrationSection
|
||||||
frameworks={frameworkIntegrationOptions}
|
frameworks={frameworkIntegrationOptions}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,81 +0,0 @@
|
|||||||
import {
|
|
||||||
CLIENT_ID_HEROKU,
|
|
||||||
CLIENT_ID_NETLIFY
|
|
||||||
} from '../../components/utilities/config';
|
|
||||||
|
|
||||||
const cloudIntegrationOptions = [
|
|
||||||
{
|
|
||||||
name: 'Heroku',
|
|
||||||
slug: 'heroku',
|
|
||||||
image: 'Heroku',
|
|
||||||
isAvailable: true,
|
|
||||||
type: 'oauth2',
|
|
||||||
clientId: CLIENT_ID_HEROKU,
|
|
||||||
docsLink: ''
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Vercel',
|
|
||||||
slug: 'vercel',
|
|
||||||
image: 'Vercel',
|
|
||||||
isAvailable: true,
|
|
||||||
type: 'vercel',
|
|
||||||
clientId: '',
|
|
||||||
docsLink: ''
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Netlify',
|
|
||||||
slug: 'netlify',
|
|
||||||
image: 'Netlify',
|
|
||||||
isAvailable: true,
|
|
||||||
type: 'oauth2',
|
|
||||||
clientId: CLIENT_ID_NETLIFY,
|
|
||||||
docsLink: ''
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Google Cloud Platform',
|
|
||||||
slug: 'gcp',
|
|
||||||
image: 'Google Cloud Platform',
|
|
||||||
isAvailable: false,
|
|
||||||
type: '',
|
|
||||||
clientId: '',
|
|
||||||
docsLink: ''
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Amazon Web Services',
|
|
||||||
slug: 'aws',
|
|
||||||
image: 'Amazon Web Services',
|
|
||||||
isAvailable: false,
|
|
||||||
type: '',
|
|
||||||
clientId: '',
|
|
||||||
docsLink: ''
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Microsoft Azure',
|
|
||||||
slug: 'azure',
|
|
||||||
image: 'Microsoft Azure',
|
|
||||||
isAvailable: false,
|
|
||||||
type: '',
|
|
||||||
clientId: '',
|
|
||||||
docsLink: ''
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Travis CI',
|
|
||||||
slug: 'travisci',
|
|
||||||
image: 'Travis CI',
|
|
||||||
isAvailable: false,
|
|
||||||
type: '',
|
|
||||||
clientId: '',
|
|
||||||
docsLink: ''
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Circle CI',
|
|
||||||
slug: 'circleci',
|
|
||||||
image: 'Circle CI',
|
|
||||||
isAvailable: false,
|
|
||||||
type: '',
|
|
||||||
clientId: '',
|
|
||||||
docsLink: ''
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
export { cloudIntegrationOptions };
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"name": "Heroku",
|
|
||||||
"slug": "heroku",
|
|
||||||
"image": "Heroku",
|
|
||||||
"isAvailable": true,
|
|
||||||
"type": "oauth2",
|
|
||||||
"clientId": "7b1311a1-1cb2-4938-8adf-f37a399ec41b",
|
|
||||||
"docsLink": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Vercel",
|
|
||||||
"slug": "vercel",
|
|
||||||
"image": "Vercel",
|
|
||||||
"isAvailable": true,
|
|
||||||
"type": "vercel",
|
|
||||||
"clientId": "",
|
|
||||||
"docsLink": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Netlify",
|
|
||||||
"slug": "netlify",
|
|
||||||
"image": "Netlify",
|
|
||||||
"isAvailable": true,
|
|
||||||
"type": "oauth2",
|
|
||||||
"clientId": "fYWBhD3gt0pT62UIwYrlGRcy--pPVLYIQad6ORrES9o",
|
|
||||||
"redirectURL": "http://localhost:8080/netlify",
|
|
||||||
"docsLink": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Google Cloud Platform",
|
|
||||||
"slug": "gcp",
|
|
||||||
"image": "Google Cloud Platform",
|
|
||||||
"isAvailable": false,
|
|
||||||
"type": "",
|
|
||||||
"clientId": "",
|
|
||||||
"docsLink": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Amazon Web Services",
|
|
||||||
"slug": "aws",
|
|
||||||
"image": "Amazon Web Services",
|
|
||||||
"isAvailable": false,
|
|
||||||
"type": "",
|
|
||||||
"clientId": "",
|
|
||||||
"docsLink": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Microsoft Azure",
|
|
||||||
"slug": "azure",
|
|
||||||
"image": "Microsoft Azure",
|
|
||||||
"isAvailable": false,
|
|
||||||
"type": "",
|
|
||||||
"clientId": "",
|
|
||||||
"docsLink": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Travis CI",
|
|
||||||
"slug": "travisci",
|
|
||||||
"image": "Travis CI",
|
|
||||||
"isAvailable": false,
|
|
||||||
"type": "",
|
|
||||||
"clientId": "",
|
|
||||||
"docsLink": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Circle CI",
|
|
||||||
"slug": "circleci",
|
|
||||||
"image": "Circle CI",
|
|
||||||
"isAvailable": false,
|
|
||||||
"type": "",
|
|
||||||
"clientId": "",
|
|
||||||
"docsLink": ""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
Reference in New Issue
Block a user