mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 10:58:56 +00:00
### What does this PR do? Fixes https://github.com/oven-sh/bun/issues/23178 Fixes https://github.com/oven-sh/bun/issues/23187 Fixes https://github.com/oven-sh/bun/issues/23198 ### How did you verify your code works? Test --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
29 lines
558 B
TypeScript
29 lines
558 B
TypeScript
import { RedisClient } from "bun";
|
|
|
|
function getOptions() {
|
|
if (process.env.BUN_VALKEY_TLS) {
|
|
const paths = JSON.parse(process.env.BUN_VALKEY_TLS);
|
|
return {
|
|
tls: {
|
|
key: Bun.file(paths.key),
|
|
cert: Bun.file(paths.cert),
|
|
ca: Bun.file(paths.ca),
|
|
},
|
|
};
|
|
}
|
|
return {};
|
|
}
|
|
|
|
{
|
|
const client = new RedisClient(process.env.BUN_VALKEY_URL, getOptions());
|
|
client
|
|
.connect()
|
|
.then(redis => {
|
|
console.log("connected");
|
|
client.close();
|
|
})
|
|
.catch(err => {
|
|
console.error(err);
|
|
});
|
|
}
|