mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 16:40:30 +00:00
misc: renamed disable flag + docs
This commit is contained in:
@@ -3,16 +3,16 @@ import { Knex } from "knex";
|
||||
import { TableName } from "../schemas";
|
||||
|
||||
export async function up(knex: Knex): Promise<void> {
|
||||
const hasSkipBootstrapCertValidationCol = await knex.schema.hasColumn(
|
||||
const hasDisableBootstrapCertValidationCol = await knex.schema.hasColumn(
|
||||
TableName.CertificateTemplateEstConfig,
|
||||
"skipBootstrapCertValidation"
|
||||
"disableBootstrapCertValidation"
|
||||
);
|
||||
|
||||
const hasCaChainCol = await knex.schema.hasColumn(TableName.CertificateTemplateEstConfig, "encryptedCaChain");
|
||||
|
||||
await knex.schema.alterTable(TableName.CertificateTemplateEstConfig, (t) => {
|
||||
if (!hasSkipBootstrapCertValidationCol) {
|
||||
t.boolean("skipBootstrapCertValidation").defaultTo(false).notNullable();
|
||||
if (!hasDisableBootstrapCertValidationCol) {
|
||||
t.boolean("disableBootstrapCertValidation").defaultTo(false).notNullable();
|
||||
}
|
||||
|
||||
if (hasCaChainCol) {
|
||||
@@ -22,16 +22,16 @@ export async function up(knex: Knex): Promise<void> {
|
||||
}
|
||||
|
||||
export async function down(knex: Knex): Promise<void> {
|
||||
const hasSkipBootstrapCertValidationCol = await knex.schema.hasColumn(
|
||||
const hasDisableBootstrapCertValidationCol = await knex.schema.hasColumn(
|
||||
TableName.CertificateTemplateEstConfig,
|
||||
"skipBootstrapCertValidation"
|
||||
"disableBootstrapCertValidation"
|
||||
);
|
||||
|
||||
const hasCaChainCol = await knex.schema.hasColumn(TableName.CertificateTemplateEstConfig, "encryptedCaChain");
|
||||
|
||||
await knex.schema.alterTable(TableName.CertificateTemplateEstConfig, (t) => {
|
||||
if (hasSkipBootstrapCertValidationCol) {
|
||||
t.dropColumn("skipBootstrapCertValidation");
|
||||
if (hasDisableBootstrapCertValidationCol) {
|
||||
t.dropColumn("disableBootstrapCertValidation");
|
||||
}
|
||||
|
||||
if (hasCaChainCol) {
|
||||
|
||||
@@ -17,7 +17,7 @@ export const CertificateTemplateEstConfigsSchema = z.object({
|
||||
isEnabled: z.boolean(),
|
||||
createdAt: z.date(),
|
||||
updatedAt: z.date(),
|
||||
skipBootstrapCertValidation: z.boolean().default(false)
|
||||
disableBootstrapCertValidation: z.boolean().default(false)
|
||||
});
|
||||
|
||||
export type TCertificateTemplateEstConfigs = z.infer<typeof CertificateTemplateEstConfigsSchema>;
|
||||
|
||||
@@ -171,7 +171,7 @@ export const certificateEstServiceFactory = ({
|
||||
});
|
||||
}
|
||||
|
||||
if (!estConfig.skipBootstrapCertValidation) {
|
||||
if (!estConfig.disableBootstrapCertValidation) {
|
||||
const caCerts = estConfig.caChain
|
||||
.match(/-----BEGIN CERTIFICATE-----[\s\S]+?-----END CERTIFICATE-----/g)
|
||||
?.map((cert) => {
|
||||
|
||||
@@ -15,7 +15,7 @@ const sanitizedEstConfig = CertificateTemplateEstConfigsSchema.pick({
|
||||
id: true,
|
||||
certificateTemplateId: true,
|
||||
isEnabled: true,
|
||||
skipBootstrapCertValidation: true
|
||||
disableBootstrapCertValidation: true
|
||||
});
|
||||
|
||||
export const registerCertificateTemplateRouter = async (server: FastifyZodProvider) => {
|
||||
@@ -247,11 +247,11 @@ export const registerCertificateTemplateRouter = async (server: FastifyZodProvid
|
||||
caChain: z.string().trim().optional(),
|
||||
passphrase: z.string().min(1),
|
||||
isEnabled: z.boolean().default(true),
|
||||
skipBootstrapCertValidation: z.boolean().default(false)
|
||||
disableBootstrapCertValidation: z.boolean().default(false)
|
||||
})
|
||||
.refine(
|
||||
({ caChain, skipBootstrapCertValidation }) =>
|
||||
skipBootstrapCertValidation || (!skipBootstrapCertValidation && caChain),
|
||||
({ caChain, disableBootstrapCertValidation }) =>
|
||||
disableBootstrapCertValidation || (!disableBootstrapCertValidation && caChain),
|
||||
"CA chain is required"
|
||||
),
|
||||
response: {
|
||||
@@ -299,7 +299,7 @@ export const registerCertificateTemplateRouter = async (server: FastifyZodProvid
|
||||
body: z.object({
|
||||
caChain: z.string().trim().optional(),
|
||||
passphrase: z.string().min(1).optional(),
|
||||
skipBootstrapCertValidation: z.boolean().optional(),
|
||||
disableBootstrapCertValidation: z.boolean().optional(),
|
||||
isEnabled: z.boolean().optional()
|
||||
}),
|
||||
response: {
|
||||
|
||||
@@ -236,7 +236,7 @@ export const certificateTemplateServiceFactory = ({
|
||||
actorAuthMethod,
|
||||
actor,
|
||||
actorOrgId,
|
||||
skipBootstrapCertValidation
|
||||
disableBootstrapCertValidation
|
||||
}: TCreateEstConfigurationDTO) => {
|
||||
const plan = await licenseService.getPlan(actorOrgId);
|
||||
if (!plan.pkiEst) {
|
||||
@@ -305,7 +305,7 @@ export const certificateTemplateServiceFactory = ({
|
||||
hashedPassphrase,
|
||||
encryptedCaChain,
|
||||
isEnabled,
|
||||
skipBootstrapCertValidation
|
||||
disableBootstrapCertValidation
|
||||
});
|
||||
|
||||
return { ...estConfig, projectId: certTemplate.projectId };
|
||||
@@ -320,7 +320,7 @@ export const certificateTemplateServiceFactory = ({
|
||||
actorAuthMethod,
|
||||
actor,
|
||||
actorOrgId,
|
||||
skipBootstrapCertValidation
|
||||
disableBootstrapCertValidation
|
||||
}: TUpdateEstConfigurationDTO) => {
|
||||
const plan = await licenseService.getPlan(actorOrgId);
|
||||
if (!plan.pkiEst) {
|
||||
@@ -369,7 +369,7 @@ export const certificateTemplateServiceFactory = ({
|
||||
|
||||
const updatedData: TCertificateTemplateEstConfigsUpdate = {
|
||||
isEnabled,
|
||||
skipBootstrapCertValidation
|
||||
disableBootstrapCertValidation
|
||||
};
|
||||
|
||||
if (caChain) {
|
||||
@@ -468,7 +468,7 @@ export const certificateTemplateServiceFactory = ({
|
||||
hashedPassphrase: estConfig.hashedPassphrase,
|
||||
projectId: certTemplate.projectId,
|
||||
orgId: certTemplate.orgId,
|
||||
skipBootstrapCertValidation: estConfig.skipBootstrapCertValidation
|
||||
disableBootstrapCertValidation: estConfig.disableBootstrapCertValidation
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ export type TCreateEstConfigurationDTO = {
|
||||
caChain?: string;
|
||||
passphrase: string;
|
||||
isEnabled: boolean;
|
||||
skipBootstrapCertValidation: boolean;
|
||||
disableBootstrapCertValidation: boolean;
|
||||
} & Omit<TProjectPermission, "projectId">;
|
||||
|
||||
export type TUpdateEstConfigurationDTO = {
|
||||
@@ -45,7 +45,7 @@ export type TUpdateEstConfigurationDTO = {
|
||||
caChain?: string;
|
||||
passphrase?: string;
|
||||
isEnabled?: boolean;
|
||||
skipBootstrapCertValidation?: boolean;
|
||||
disableBootstrapCertValidation?: boolean;
|
||||
} & Omit<TProjectPermission, "projectId">;
|
||||
|
||||
export type TGetEstConfigurationDTO =
|
||||
|
||||
Reference in New Issue
Block a user