constcreateTcpPoolSslCerts=asyncconfig=>{// Extract host and port from socket addressconstdbSocketAddr=process.env.DB_HOST.split(':');// e.g. '127.0.0.1:5432'// Establish a connection to the databasereturnKnex({client:'pg',connection:{user:process.env.DB_USER,// e.g. 'my-user'password:process.env.DB_PASS,// e.g. 'my-user-password'database:process.env.DB_NAME,// e.g. 'my-database'host:dbSocketAddr[0],// e.g. '127.0.0.1'port:dbSocketAddr[1],// e.g. '5432'ssl:{rejectUnauthorized:false,ca:fs.readFileSync(process.env.DB_ROOT_CERT),// e.g., '/path/to/my/server-ca.pem'key:fs.readFileSync(process.env.DB_KEY),// e.g. '/path/to/my/client-key.pem'cert:fs.readFileSync(process.env.DB_CERT),// e.g. '/path/to/my/client-cert.pem'},},// ... Specify additional properties here....config,});};
Nächste Schritte
Informationen zum Suchen und Filtern von Codebeispielen für andere Google Cloud-Produkte finden Sie im Google Cloud-Beispielbrowser.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],[],[],[]]