File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 KEY_TOP_PODCASTS ,
88} from '@/data/constants' ;
99import type { IEpisodeListing , IPodcast , IShortUrl } from '@/types' ;
10+ import { mtls } from '@/server/mtls' ;
1011
1112/**
1213 * Redis cached entity with timestamp
@@ -61,6 +62,7 @@ const redis = new Redis({
6162 host : process . env . KV_REDIS_HOST ,
6263 password : process . env . KV_REDIS_PASS ,
6364 port : parseInt ( process . env . KV_REDIS_PORT || '0' , 10 ) ,
65+ tls : mtls ,
6466} ) ;
6567
6668/**
Original file line number Diff line number Diff line change 11import postgres from 'postgres' ;
22
3+ import { mtls } from './mtls' ;
4+
35const connectionString = process . env . DATABASE_URL ;
46
57if ( ! connectionString ) {
@@ -10,6 +12,7 @@ export const sql = postgres(connectionString, {
1012 max : 10 ,
1113 idle_timeout : 20 ,
1214 connect_timeout : 10 ,
15+ ssl : mtls ,
1316 types : {
1417 bigint : {
1518 to : 20 ,
Original file line number Diff line number Diff line change 1+ const pem = ( value ?: string ) => value ?. replace ( / \\ n / g, '\n' ) ;
2+
3+ const ca = pem ( process . env . MTLS_CA ) ;
4+
5+ export const mtls = ca
6+ ? {
7+ ca,
8+ cert : pem ( process . env . MTLS_CERT ) ,
9+ key : pem ( process . env . MTLS_KEY ) ,
10+ rejectUnauthorized : true ,
11+ }
12+ : undefined ;
You can’t perform that action at this time.
0 commit comments