feat: TLS certificate file support

- NewConnectionDialog: TLS cert file selectors (CA/Cert/Key) + rejectUnauthorized checkbox
- connection.ts: read cert files and pass to ioredis tls options
- Add tlsRejectUnauthorized to all ConnectionConfig types
- i18n keys for tlsCaPath/tlsCertPath/tlsKeyPath/tlsRejectUnauthorized
This commit is contained in:
2026-07-05 16:35:38 +08:00
parent 6e6f170403
commit 1686af1a79
8 changed files with 102 additions and 8 deletions
+16 -2
View File
@@ -13,6 +13,10 @@ export interface ConnectionOptions {
username?: string
password?: string
tls?: boolean
tlsCaPath?: string
tlsCertPath?: string
tlsKeyPath?: string
tlsRejectUnauthorized?: boolean
sshEnabled?: boolean
sshHost?: string
sshPort?: number
@@ -121,10 +125,20 @@ function buildRedisOptions(opts: ConnectionOptions): RedisOptions {
}
if (opts.tls) {
options.tls = {
rejectUnauthorized: false,
const tlsOpts: any = {
rejectUnauthorized: opts.tlsRejectUnauthorized || false,
checkServerIdentity: () => undefined,
}
if (opts.tlsCaPath) {
try { tlsOpts.ca = readFileSync(expandHomePath(opts.tlsCaPath)) } catch { /* ignore */ }
}
if (opts.tlsCertPath) {
try { tlsOpts.cert = readFileSync(expandHomePath(opts.tlsCertPath)) } catch { /* ignore */ }
}
if (opts.tlsKeyPath) {
try { tlsOpts.key = readFileSync(expandHomePath(opts.tlsKeyPath)) } catch { /* ignore */ }
}
options.tls = tlsOpts
}
return options
+1
View File
@@ -12,6 +12,7 @@ interface ConnectionConfig {
tlsCaPath: string
tlsCertPath: string
tlsKeyPath: string
tlsRejectUnauthorized: boolean
sshEnabled: boolean
sshHost: string
sshPort: number
+1
View File
@@ -10,6 +10,7 @@ export interface ConnectionConfig {
tlsCaPath: string
tlsCertPath: string
tlsKeyPath: string
tlsRejectUnauthorized: boolean
sshEnabled: boolean
sshHost: string
sshPort: number