diff --git a/packages/cli/src/Db.ts b/packages/cli/src/Db.ts index 596052667e..daebfa031d 100644 --- a/packages/cli/src/Db.ts +++ b/packages/cli/src/Db.ts @@ -90,7 +90,7 @@ export function getConnectionOptions(dbType: DatabaseType): ConnectionOptions { const sslKey = config.getEnv('database.postgresdb.ssl.key'); const sslRejectUnauthorized = config.getEnv('database.postgresdb.ssl.rejectUnauthorized'); - let ssl: TlsOptions | undefined; + let ssl: TlsOptions | boolean = config.getEnv('database.postgresdb.ssl.enabled'); if (sslCa !== '' || sslCert !== '' || sslKey !== '' || !sslRejectUnauthorized) { ssl = { ca: sslCa || undefined, diff --git a/packages/cli/src/config/schema.ts b/packages/cli/src/config/schema.ts index 65590d27a1..ae92095441 100644 --- a/packages/cli/src/config/schema.ts +++ b/packages/cli/src/config/schema.ts @@ -92,6 +92,12 @@ export const schema = { }, ssl: { + enabled: { + doc: 'If SSL should be enabled. If `ca`, `cert`, or `key` are defined, this will automatically default to true', + format: 'Boolean', + default: false, + env: 'DB_POSTGRESDB_SSL_ENABLED', + }, ca: { doc: 'SSL certificate authority', format: String,