mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 14:27:59 +00:00
impl improvements according to greptile
This commit is contained in:
@@ -7,19 +7,25 @@ export async function up(knex: Knex): Promise<void> {
|
|||||||
const hasDefaultHostCaCol = await knex.schema.hasColumn(TableName.ProjectSshConfig, "defaultHostSshCaId");
|
const hasDefaultHostCaCol = await knex.schema.hasColumn(TableName.ProjectSshConfig, "defaultHostSshCaId");
|
||||||
|
|
||||||
if (hasDefaultUserCaCol && hasDefaultHostCaCol) {
|
if (hasDefaultUserCaCol && hasDefaultHostCaCol) {
|
||||||
await knex.schema.alterTable(TableName.ProjectSshConfig, (t) => {
|
await knex.transaction(async (trx) => {
|
||||||
t.dropForeign(["defaultUserSshCaId"]);
|
await trx.schema.alterTable(TableName.ProjectSshConfig, (t) => {
|
||||||
t.dropForeign(["defaultHostSshCaId"]);
|
t.dropForeign(["defaultUserSshCaId"]);
|
||||||
});
|
t.dropForeign(["defaultHostSshCaId"]);
|
||||||
|
});
|
||||||
await knex.schema.alterTable(TableName.ProjectSshConfig, (t) => {
|
await trx.schema.alterTable(TableName.ProjectSshConfig, (t) => {
|
||||||
// allow nullable (does not wipe existing values)
|
// allow nullable (does not wipe existing values)
|
||||||
t.uuid("defaultUserSshCaId").nullable().alter();
|
t.uuid("defaultUserSshCaId").nullable().alter();
|
||||||
t.uuid("defaultHostSshCaId").nullable().alter();
|
t.uuid("defaultHostSshCaId").nullable().alter();
|
||||||
|
// re-add with SET NULL behavior (previously CASCADE)
|
||||||
// re-add with SET NULL behavior (previously CASCADE)
|
t.foreign("defaultUserSshCaId")
|
||||||
t.foreign("defaultUserSshCaId").references("id").inTable(TableName.SshCertificateAuthority).onDelete("SET NULL");
|
.references("id")
|
||||||
t.foreign("defaultHostSshCaId").references("id").inTable(TableName.SshCertificateAuthority).onDelete("SET NULL");
|
.inTable(TableName.SshCertificateAuthority)
|
||||||
|
.onDelete("SET NULL");
|
||||||
|
t.foreign("defaultHostSshCaId")
|
||||||
|
.references("id")
|
||||||
|
.inTable(TableName.SshCertificateAuthority)
|
||||||
|
.onDelete("SET NULL");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,12 +26,12 @@ This command enables you to obtain SSH credentials used to access a remote host.
|
|||||||
The login user for the SSH connection. If not provided, you will be prompted to select from available login users.
|
The login user for the SSH connection. If not provided, you will be prompted to select from available login users.
|
||||||
</Accordion>
|
</Accordion>
|
||||||
<Accordion title="--writeHostCaToFile">
|
<Accordion title="--writeHostCaToFile">
|
||||||
Whether to write the Host CA public key to ~/.ssh/known_hosts if it doesn't already exist.
|
Whether to write the Host CA public key to `~/.ssh/known_hosts` if it doesn't already exist.
|
||||||
|
|
||||||
Default value: `true`
|
Default value: `true`
|
||||||
</Accordion>
|
</Accordion>
|
||||||
<Accordion title="--outFilePath">
|
<Accordion title="--outFilePath">
|
||||||
The path to write the SSH credentials to such as ~/.ssh, ./some_folder, ./some_folder/id_rsa-cert.pub. If not provided, the credentials will be added to the SSH agent and used to establish an interactive SSH connection.
|
The path to write the SSH credentials to such as `~/.ssh`, `./some_folder`, `./some_folder/id_rsa-cert.pub`. If not provided, the credentials will be added to the SSH agent and used to establish an interactive SSH connection.
|
||||||
</Accordion>
|
</Accordion>
|
||||||
<Accordion title="--token">
|
<Accordion title="--token">
|
||||||
An authenticated token to use to authenticate with Infisical.
|
An authenticated token to use to authenticate with Infisical.
|
||||||
|
|||||||
+4
-4
@@ -15,8 +15,8 @@ import {
|
|||||||
|
|
||||||
const schema = z
|
const schema = z
|
||||||
.object({
|
.object({
|
||||||
defaultUserSshCaId: z.string().optional(),
|
defaultUserSshCaId: z.string(),
|
||||||
defaultHostSshCaId: z.string().optional()
|
defaultHostSshCaId: z.string()
|
||||||
})
|
})
|
||||||
.required();
|
.required();
|
||||||
|
|
||||||
@@ -40,8 +40,8 @@ export const ProjectSshConfigCasSection = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (sshConfig) {
|
if (sshConfig) {
|
||||||
reset({
|
reset({
|
||||||
defaultUserSshCaId: sshConfig.defaultUserSshCaId || undefined,
|
defaultUserSshCaId: sshConfig.defaultUserSshCaId || "",
|
||||||
defaultHostSshCaId: sshConfig.defaultHostSshCaId || undefined
|
defaultHostSshCaId: sshConfig.defaultHostSshCaId || ""
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [sshConfig]);
|
}, [sshConfig]);
|
||||||
|
|||||||
Reference in New Issue
Block a user