feat: pre command for ssh deploy

This commit is contained in:
Madray Haven
2024-09-27 15:12:04 +08:00
parent 38d975a3bb
commit 9acdd15c1e
4 changed files with 54 additions and 17 deletions

View File

@@ -4,7 +4,7 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"dev": "vite --host",
"build": "tsc -b && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"

View File

@@ -79,6 +79,7 @@ const AccessSSHForm = ({
key: z.string().min(0).max(20480),
keyFile: z.any().optional(),
command: z.string().min(1).max(2048),
preCommand: z.string().min(0).max(2048).optional(),
certPath: z.string().min(0).max(2048),
keyPath: z.string().min(0).max(2048),
});
@@ -90,6 +91,7 @@ const AccessSSHForm = ({
password: "",
key: "",
keyFile: "",
preCommand: "",
command: "sudo service nginx restart",
certPath: "/etc/nginx/ssl/certificate.crt",
keyPath: "/etc/nginx/ssl/private.key",
@@ -112,6 +114,7 @@ const AccessSSHForm = ({
certPath: config.certPath,
keyPath: config.keyPath,
command: config.command,
preCommand: config.preCommand,
},
});
@@ -133,6 +136,7 @@ const AccessSSHForm = ({
password: data.password,
key: data.key,
command: data.command,
preCommand: data.preCommand,
certPath: data.certPath,
keyPath: data.keyPath,
},
@@ -468,6 +472,21 @@ const AccessSSHForm = ({
)}
/>
<FormField
control={form.control}
name="preCommand"
render={({ field }) => (
<FormItem>
<FormLabel> Command</FormLabel>
<FormControl>
<Textarea placeholder="请输入要在部署证书前执行的前置命令" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="command"

View File

@@ -86,6 +86,7 @@ export type GodaddyConfig = {
export type SSHConfig = {
host: string;
port: string;
preCommand?: string;
command: string;
username: string;
password?: string;