mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-19 14:33:52 +00:00
* feat: implement railway secret sync * fix: railway sync config * feat: add documentation on railway * fix: undo mock on-prem change * lint: fix * fix: cleanup railway integration * fix: retry and doc images * fix: sync fields * fix: query typo * Update docs/docs.json Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
68 lines
1.9 KiB
TypeScript
68 lines
1.9 KiB
TypeScript
import { z } from "zod";
|
|
|
|
import { readLimit } from "@app/server/config/rateLimiter";
|
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
|
import { AppConnection } from "@app/services/app-connection/app-connection-enums";
|
|
import {
|
|
CreateRailwayConnectionSchema,
|
|
SanitizedRailwayConnectionSchema,
|
|
UpdateRailwayConnectionSchema
|
|
} from "@app/services/app-connection/railway";
|
|
import { AuthMode } from "@app/services/auth/auth-type";
|
|
|
|
import { registerAppConnectionEndpoints } from "./app-connection-endpoints";
|
|
|
|
export const registerRailwayConnectionRouter = async (server: FastifyZodProvider) => {
|
|
registerAppConnectionEndpoints({
|
|
app: AppConnection.Railway,
|
|
server,
|
|
sanitizedResponseSchema: SanitizedRailwayConnectionSchema,
|
|
createSchema: CreateRailwayConnectionSchema,
|
|
updateSchema: UpdateRailwayConnectionSchema
|
|
});
|
|
|
|
// The below endpoints are not exposed and for Infisical App use
|
|
server.route({
|
|
method: "GET",
|
|
url: `/:connectionId/projects`,
|
|
config: {
|
|
rateLimit: readLimit
|
|
},
|
|
schema: {
|
|
params: z.object({
|
|
connectionId: z.string().uuid()
|
|
}),
|
|
response: {
|
|
200: z.object({
|
|
projects: z
|
|
.object({
|
|
name: z.string(),
|
|
id: z.string(),
|
|
services: z.array(
|
|
z.object({
|
|
name: z.string(),
|
|
id: z.string()
|
|
})
|
|
),
|
|
environments: z.array(
|
|
z.object({
|
|
name: z.string(),
|
|
id: z.string()
|
|
})
|
|
)
|
|
})
|
|
.array()
|
|
})
|
|
}
|
|
},
|
|
onRequest: verifyAuth([AuthMode.JWT]),
|
|
handler: async (req) => {
|
|
const { connectionId } = req.params;
|
|
|
|
const projects = await server.services.appConnection.railway.listProjects(connectionId, req.permission);
|
|
|
|
return { projects };
|
|
}
|
|
});
|
|
};
|