mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
opsie
This commit is contained in:
28
test/js/valkey/valkey.connecting.fixture.ts
Normal file
28
test/js/valkey/valkey.connecting.fixture.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
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);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user