mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Review fixes
This commit is contained in:
@@ -3,6 +3,7 @@ import { AxiosError } from "axios";
|
||||
import { request } from "@app/lib/config/request";
|
||||
import { BadRequestError } from "@app/lib/errors";
|
||||
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
||||
import { IntegrationUrls } from "@app/services/integration-auth/integration-list";
|
||||
|
||||
import { FlyioConnectionMethod } from "./flyio-connection-enums";
|
||||
import { TFlyioApp, TFlyioConnection, TFlyioConnectionConfig } from "./flyio-connection-types";
|
||||
@@ -20,7 +21,7 @@ export const validateFlyioConnectionCredentials = async (config: TFlyioConnectio
|
||||
|
||||
try {
|
||||
await request.post(
|
||||
"https://api.fly.io/graphql",
|
||||
IntegrationUrls.FLYIO_API_URL,
|
||||
{ query: "query { viewer { id email } }" },
|
||||
{
|
||||
headers: {
|
||||
@@ -47,7 +48,7 @@ export const listFlyioApps = async (appConnection: TFlyioConnection) => {
|
||||
const { accessToken } = appConnection.credentials;
|
||||
|
||||
const resp = await request.post<{ data: { apps: { nodes: TFlyioApp[] } } }>(
|
||||
"https://api.fly.io/graphql",
|
||||
IntegrationUrls.FLYIO_API_URL,
|
||||
{
|
||||
query:
|
||||
"query GetApps { apps { nodes { id name hostname status organization { id slug } currentRelease { version status createdAt } } } }"
|
||||
|
||||
@@ -16,6 +16,7 @@ export const FlyioConnectionAccessTokenCredentialsSchema = z.object({
|
||||
.trim()
|
||||
.min(1, "Access Token required")
|
||||
.max(1000)
|
||||
.startsWith("FlyV1", "Token must start with 'FlyV1'")
|
||||
.describe(AppConnections.CREDENTIALS.FLYIO.accessToken)
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { request } from "@app/lib/config/request";
|
||||
import { IntegrationUrls } from "@app/services/integration-auth/integration-list";
|
||||
import {
|
||||
TDeleteFlyioVariable,
|
||||
TFlyioListVariables,
|
||||
@@ -14,7 +15,7 @@ import { SECRET_SYNC_NAME_MAP } from "../secret-sync-maps";
|
||||
|
||||
const listFlyioSecrets = async ({ accessToken, appId }: TFlyioListVariables) => {
|
||||
const { data } = await request.post<{ data: { app: { secrets: TFlyioSecret[] } } }>(
|
||||
"https://api.fly.io/graphql",
|
||||
IntegrationUrls.FLYIO_API_URL,
|
||||
{
|
||||
query: "query GetAppSecrets($appId: String!) { app(id: $appId) { id name secrets { name createdAt } } }",
|
||||
variables: { appId }
|
||||
@@ -33,7 +34,7 @@ const listFlyioSecrets = async ({ accessToken, appId }: TFlyioListVariables) =>
|
||||
|
||||
const putFlyioSecrets = async ({ accessToken, appId, secretMap }: TPutFlyioVariable) => {
|
||||
return request.post(
|
||||
"https://api.fly.io/graphql",
|
||||
IntegrationUrls.FLYIO_API_URL,
|
||||
{
|
||||
query:
|
||||
"mutation SetAppSecrets($appId: ID!, $secrets: [SecretInput!]!) { setSecrets(input: { appId: $appId, secrets: $secrets }) { app { name } release { version } } }",
|
||||
@@ -53,7 +54,7 @@ const putFlyioSecrets = async ({ accessToken, appId, secretMap }: TPutFlyioVaria
|
||||
|
||||
const deleteFlyioSecrets = async ({ accessToken, appId, keys }: TDeleteFlyioVariable) => {
|
||||
return request.post(
|
||||
"https://api.fly.io/graphql",
|
||||
IntegrationUrls.FLYIO_API_URL,
|
||||
{
|
||||
query:
|
||||
"mutation UnsetAppSecrets($appId: ID!, $keys: [String!]!) { unsetSecrets(input: { appId: $appId, keys: $keys }) { app { name } release { version } } }",
|
||||
|
||||
@@ -32,7 +32,11 @@ const formSchema = z.discriminatedUnion("method", [
|
||||
rootSchema.extend({
|
||||
method: z.literal(FlyioConnectionMethod.AccessToken),
|
||||
credentials: z.object({
|
||||
accessToken: z.string().trim().min(1, "Access Token required")
|
||||
accessToken: z
|
||||
.string()
|
||||
.trim()
|
||||
.min(1, "Access Token required")
|
||||
.startsWith("FlyV1", "Token must start with 'FlyV1'")
|
||||
})
|
||||
})
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user