mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 08:27:36 +00:00
Add Heroku PR suggestions
This commit is contained in:
@@ -86,7 +86,7 @@ export const refreshHerokuToken = async (
|
|||||||
credentials: {
|
credentials: {
|
||||||
refreshToken,
|
refreshToken,
|
||||||
authToken: data.access_token,
|
authToken: data.access_token,
|
||||||
expiresAt: new Date(Date.now() + data.expires_in - 60)
|
expiresAt: new Date(Date.now() + data.expires_in * 1000 - 60000)
|
||||||
},
|
},
|
||||||
orgId,
|
orgId,
|
||||||
kmsService
|
kmsService
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import {
|
|||||||
|
|
||||||
import { HerokuConnectionMethod } from "./heroku-connection-enums";
|
import { HerokuConnectionMethod } from "./heroku-connection-enums";
|
||||||
|
|
||||||
export const HerokuConnectionAccessTokenCredentialsSchema = z.object({
|
export const HerokuConnectionAuthTokenCredentialsSchema = z.object({
|
||||||
authToken: z.string().trim().min(1, "Auth Token required")
|
authToken: z.string().trim().min(1, "Auth Token required").startsWith("HRKU-", "Token must start with 'HRKU-")
|
||||||
});
|
});
|
||||||
|
|
||||||
export const HerokuConnectionOAuthCredentialsSchema = z.object({
|
export const HerokuConnectionOAuthCredentialsSchema = z.object({
|
||||||
@@ -38,7 +38,7 @@ export const HerokuConnectionSchema = z.intersection(
|
|||||||
z.discriminatedUnion("method", [
|
z.discriminatedUnion("method", [
|
||||||
z.object({
|
z.object({
|
||||||
method: z.literal(HerokuConnectionMethod.AuthToken),
|
method: z.literal(HerokuConnectionMethod.AuthToken),
|
||||||
credentials: HerokuConnectionAccessTokenCredentialsSchema
|
credentials: HerokuConnectionAuthTokenCredentialsSchema
|
||||||
}),
|
}),
|
||||||
z.object({
|
z.object({
|
||||||
method: z.literal(HerokuConnectionMethod.OAuth),
|
method: z.literal(HerokuConnectionMethod.OAuth),
|
||||||
@@ -50,7 +50,7 @@ export const HerokuConnectionSchema = z.intersection(
|
|||||||
export const SanitizedHerokuConnectionSchema = z.discriminatedUnion("method", [
|
export const SanitizedHerokuConnectionSchema = z.discriminatedUnion("method", [
|
||||||
BaseHerokuConnectionSchema.extend({
|
BaseHerokuConnectionSchema.extend({
|
||||||
method: z.literal(HerokuConnectionMethod.AuthToken),
|
method: z.literal(HerokuConnectionMethod.AuthToken),
|
||||||
credentials: HerokuConnectionAccessTokenCredentialsSchema.pick({})
|
credentials: HerokuConnectionAuthTokenCredentialsSchema.pick({})
|
||||||
}),
|
}),
|
||||||
BaseHerokuConnectionSchema.extend({
|
BaseHerokuConnectionSchema.extend({
|
||||||
method: z.literal(HerokuConnectionMethod.OAuth),
|
method: z.literal(HerokuConnectionMethod.OAuth),
|
||||||
@@ -61,7 +61,7 @@ export const SanitizedHerokuConnectionSchema = z.discriminatedUnion("method", [
|
|||||||
export const ValidateHerokuConnectionCredentialsSchema = z.discriminatedUnion("method", [
|
export const ValidateHerokuConnectionCredentialsSchema = z.discriminatedUnion("method", [
|
||||||
z.object({
|
z.object({
|
||||||
method: z.literal(HerokuConnectionMethod.AuthToken).describe(AppConnections.CREATE(AppConnection.Heroku).method),
|
method: z.literal(HerokuConnectionMethod.AuthToken).describe(AppConnections.CREATE(AppConnection.Heroku).method),
|
||||||
credentials: HerokuConnectionAccessTokenCredentialsSchema.describe(
|
credentials: HerokuConnectionAuthTokenCredentialsSchema.describe(
|
||||||
AppConnections.CREATE(AppConnection.Heroku).credentials
|
AppConnections.CREATE(AppConnection.Heroku).credentials
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
@@ -85,7 +85,7 @@ export const UpdateHerokuConnectionSchema = z
|
|||||||
.object({
|
.object({
|
||||||
credentials: z
|
credentials: z
|
||||||
.union([
|
.union([
|
||||||
HerokuConnectionAccessTokenCredentialsSchema,
|
HerokuConnectionAuthTokenCredentialsSchema,
|
||||||
HerokuConnectionOAuthOutputCredentialsSchema,
|
HerokuConnectionOAuthOutputCredentialsSchema,
|
||||||
HerokuConnectionRefreshTokenCredentialsSchema,
|
HerokuConnectionRefreshTokenCredentialsSchema,
|
||||||
HerokuConnectionOAuthCredentialsSchema
|
HerokuConnectionOAuthCredentialsSchema
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ const getHerokuConfigVars = async ({ authToken, app }: THerokuListVariables): Pr
|
|||||||
};
|
};
|
||||||
|
|
||||||
const updateHerokuConfigVars = async ({ authToken, app, configVars }: THerokuUpdateVariables) => {
|
const updateHerokuConfigVars = async ({ authToken, app, configVars }: THerokuUpdateVariables) => {
|
||||||
return request.patch(`${IntegrationUrls.HEROKU_API_URL}/apps/${app}/config-vars`, configVars, {
|
return request.patch(`${IntegrationUrls.HEROKU_API_URL}/apps/${encodeURIComponent(app)}/config-vars`, configVars, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${authToken}`,
|
Authorization: `Bearer ${authToken}`,
|
||||||
Accept: "application/vnd.heroku+json; version=3",
|
Accept: "application/vnd.heroku+json; version=3",
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ Infisical supports two methods for connecting to Heroku: **OAuth** and **Auth To
|
|||||||
|
|
||||||
Back in your Infisical instance, add two new environment variables for the credentials of your Heroku API client:
|
Back in your Infisical instance, add two new environment variables for the credentials of your Heroku API client:
|
||||||
|
|
||||||
- `INF_APP_CONNECTION_HEROKU_CLIENT_ID`: The **Client ID** of your Heroku API client.
|
- `CLIENT_ID_HEROKU`: The **Client ID** of your Heroku API client.
|
||||||
- `INF_APP_CONNECTION_HEROKU_CLIENT_SECRET`: The **Client Secret** of your Heroku API client.
|
- `CLIENT_SECRET_HEROKU`: The **Client Secret** of your Heroku API client.
|
||||||
|
|
||||||
Once added, restart your Infisical instance and use the Heroku App Connection.
|
Once added, restart your Infisical instance and use the Heroku App Connection.
|
||||||
</Step>
|
</Step>
|
||||||
@@ -84,7 +84,7 @@ Infisical supports two methods for connecting to Heroku: **OAuth** and **Auth To
|
|||||||
<Step title="Generate Heroku API Token">
|
<Step title="Generate Heroku API Token">
|
||||||
Log in to your Heroku account and navigate to Account Settings.
|
Log in to your Heroku account and navigate to Account Settings.
|
||||||
|
|
||||||
Under the **Authorizations** section, reveal and copy your Authorization token. If you don't have one, click **Create Authorization** to create a new token.
|
Under the **Authorizations** section on the **Applications** tab, reveal and copy your Authorization token. If you don't have one, click **Create Authorization** to create a new token.
|
||||||
|
|
||||||
<Warning>
|
<Warning>
|
||||||
Keep your Authorization token secure and do not share it. Anyone with access to this token can manage your Heroku applications.
|
Keep your Authorization token secure and do not share it. Anyone with access to this token can manage your Heroku applications.
|
||||||
|
|||||||
+9
-2
@@ -81,6 +81,7 @@ export const HerokuConnectionForm = ({ appConnection, onSubmit: formSubmit }: Pr
|
|||||||
handleSubmit,
|
handleSubmit,
|
||||||
control,
|
control,
|
||||||
watch,
|
watch,
|
||||||
|
setValue,
|
||||||
formState: { isSubmitting, isDirty }
|
formState: { isSubmitting, isDirty }
|
||||||
} = form;
|
} = form;
|
||||||
|
|
||||||
@@ -175,7 +176,13 @@ export const HerokuConnectionForm = ({ appConnection, onSubmit: formSubmit }: Pr
|
|||||||
<Select
|
<Select
|
||||||
isDisabled={isUpdate}
|
isDisabled={isUpdate}
|
||||||
value={value}
|
value={value}
|
||||||
onValueChange={(val) => onChange(val)}
|
onValueChange={(val) => {
|
||||||
|
console.log("val", val === HerokuConnectionMethod.OAuth);
|
||||||
|
onChange(val);
|
||||||
|
if (val === HerokuConnectionMethod.OAuth) {
|
||||||
|
setValue("credentials.code", "custom");
|
||||||
|
}
|
||||||
|
}}
|
||||||
className="w-full border border-mineshaft-500"
|
className="w-full border border-mineshaft-500"
|
||||||
position="popper"
|
position="popper"
|
||||||
dropdownContainerClassName="max-w-none"
|
dropdownContainerClassName="max-w-none"
|
||||||
@@ -202,7 +209,7 @@ export const HerokuConnectionForm = ({ appConnection, onSubmit: formSubmit }: Pr
|
|||||||
label="Auth Token"
|
label="Auth Token"
|
||||||
errorText={error?.message}
|
errorText={error?.message}
|
||||||
isError={Boolean(error?.message)}
|
isError={Boolean(error?.message)}
|
||||||
tooltipText="Your Heroku API key or auth token"
|
tooltipText="Your Heroku Auth Token"
|
||||||
>
|
>
|
||||||
<SecretInput
|
<SecretInput
|
||||||
containerClassName="text-gray-400 group-focus-within:!border-primary-400/50 border border-mineshaft-500 bg-mineshaft-900 px-2.5 py-1.5"
|
containerClassName="text-gray-400 group-focus-within:!border-primary-400/50 border border-mineshaft-500 bg-mineshaft-900 px-2.5 py-1.5"
|
||||||
|
|||||||
+2
-2
@@ -12,8 +12,8 @@ export const HerokuSyncDestinationSection = ({ secretSync }: Props) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<GenericFieldLabel label="App name">{appName}</GenericFieldLabel>
|
<GenericFieldLabel label="App Name">{appName}</GenericFieldLabel>
|
||||||
<GenericFieldLabel label="App Id">{app}</GenericFieldLabel>
|
<GenericFieldLabel label="App ID">{app}</GenericFieldLabel>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user