mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Add Heroku PR suggestions
This commit is contained in:
@@ -86,7 +86,7 @@ export const refreshHerokuToken = async (
|
||||
credentials: {
|
||||
refreshToken,
|
||||
authToken: data.access_token,
|
||||
expiresAt: new Date(Date.now() + data.expires_in - 60)
|
||||
expiresAt: new Date(Date.now() + data.expires_in * 1000 - 60000)
|
||||
},
|
||||
orgId,
|
||||
kmsService
|
||||
|
||||
@@ -10,8 +10,8 @@ import {
|
||||
|
||||
import { HerokuConnectionMethod } from "./heroku-connection-enums";
|
||||
|
||||
export const HerokuConnectionAccessTokenCredentialsSchema = z.object({
|
||||
authToken: z.string().trim().min(1, "Auth Token required")
|
||||
export const HerokuConnectionAuthTokenCredentialsSchema = z.object({
|
||||
authToken: z.string().trim().min(1, "Auth Token required").startsWith("HRKU-", "Token must start with 'HRKU-")
|
||||
});
|
||||
|
||||
export const HerokuConnectionOAuthCredentialsSchema = z.object({
|
||||
@@ -38,7 +38,7 @@ export const HerokuConnectionSchema = z.intersection(
|
||||
z.discriminatedUnion("method", [
|
||||
z.object({
|
||||
method: z.literal(HerokuConnectionMethod.AuthToken),
|
||||
credentials: HerokuConnectionAccessTokenCredentialsSchema
|
||||
credentials: HerokuConnectionAuthTokenCredentialsSchema
|
||||
}),
|
||||
z.object({
|
||||
method: z.literal(HerokuConnectionMethod.OAuth),
|
||||
@@ -50,7 +50,7 @@ export const HerokuConnectionSchema = z.intersection(
|
||||
export const SanitizedHerokuConnectionSchema = z.discriminatedUnion("method", [
|
||||
BaseHerokuConnectionSchema.extend({
|
||||
method: z.literal(HerokuConnectionMethod.AuthToken),
|
||||
credentials: HerokuConnectionAccessTokenCredentialsSchema.pick({})
|
||||
credentials: HerokuConnectionAuthTokenCredentialsSchema.pick({})
|
||||
}),
|
||||
BaseHerokuConnectionSchema.extend({
|
||||
method: z.literal(HerokuConnectionMethod.OAuth),
|
||||
@@ -61,7 +61,7 @@ export const SanitizedHerokuConnectionSchema = z.discriminatedUnion("method", [
|
||||
export const ValidateHerokuConnectionCredentialsSchema = z.discriminatedUnion("method", [
|
||||
z.object({
|
||||
method: z.literal(HerokuConnectionMethod.AuthToken).describe(AppConnections.CREATE(AppConnection.Heroku).method),
|
||||
credentials: HerokuConnectionAccessTokenCredentialsSchema.describe(
|
||||
credentials: HerokuConnectionAuthTokenCredentialsSchema.describe(
|
||||
AppConnections.CREATE(AppConnection.Heroku).credentials
|
||||
)
|
||||
}),
|
||||
@@ -85,7 +85,7 @@ export const UpdateHerokuConnectionSchema = z
|
||||
.object({
|
||||
credentials: z
|
||||
.union([
|
||||
HerokuConnectionAccessTokenCredentialsSchema,
|
||||
HerokuConnectionAuthTokenCredentialsSchema,
|
||||
HerokuConnectionOAuthOutputCredentialsSchema,
|
||||
HerokuConnectionRefreshTokenCredentialsSchema,
|
||||
HerokuConnectionOAuthCredentialsSchema
|
||||
|
||||
@@ -55,7 +55,7 @@ const getHerokuConfigVars = async ({ authToken, app }: THerokuListVariables): Pr
|
||||
};
|
||||
|
||||
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: {
|
||||
Authorization: `Bearer ${authToken}`,
|
||||
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:
|
||||
|
||||
- `INF_APP_CONNECTION_HEROKU_CLIENT_ID`: The **Client ID** of your Heroku API client.
|
||||
- `INF_APP_CONNECTION_HEROKU_CLIENT_SECRET`: The **Client Secret** of your Heroku API client.
|
||||
- `CLIENT_ID_HEROKU`: The **Client ID** 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.
|
||||
</Step>
|
||||
@@ -84,7 +84,7 @@ Infisical supports two methods for connecting to Heroku: **OAuth** and **Auth To
|
||||
<Step title="Generate Heroku API Token">
|
||||
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>
|
||||
Keep your Authorization token secure and do not share it. Anyone with access to this token can manage your Heroku applications.
|
||||
|
||||
@@ -81,6 +81,7 @@ export const HerokuConnectionForm = ({ appConnection, onSubmit: formSubmit }: Pr
|
||||
handleSubmit,
|
||||
control,
|
||||
watch,
|
||||
setValue,
|
||||
formState: { isSubmitting, isDirty }
|
||||
} = form;
|
||||
|
||||
@@ -175,7 +176,13 @@ export const HerokuConnectionForm = ({ appConnection, onSubmit: formSubmit }: Pr
|
||||
<Select
|
||||
isDisabled={isUpdate}
|
||||
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"
|
||||
position="popper"
|
||||
dropdownContainerClassName="max-w-none"
|
||||
@@ -202,7 +209,7 @@ export const HerokuConnectionForm = ({ appConnection, onSubmit: formSubmit }: Pr
|
||||
label="Auth Token"
|
||||
errorText={error?.message}
|
||||
isError={Boolean(error?.message)}
|
||||
tooltipText="Your Heroku API key or auth token"
|
||||
tooltipText="Your Heroku Auth Token"
|
||||
>
|
||||
<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"
|
||||
|
||||
@@ -12,8 +12,8 @@ export const HerokuSyncDestinationSection = ({ secretSync }: Props) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<GenericFieldLabel label="App name">{appName}</GenericFieldLabel>
|
||||
<GenericFieldLabel label="App Id">{app}</GenericFieldLabel>
|
||||
<GenericFieldLabel label="App Name">{appName}</GenericFieldLabel>
|
||||
<GenericFieldLabel label="App ID">{app}</GenericFieldLabel>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user