From 0c13e7c8b5a49fab273d97c2e190f20e8c9ee6bd Mon Sep 17 00:00:00 2001 From: microshine Date: Wed, 31 Jan 2024 00:13:51 +0100 Subject: [PATCH] test: update config.ts to dynamically set the lib path based on the platform --- test/config.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/test/config.ts b/test/config.ts index 1b92df77..d82631d7 100644 --- a/test/config.ts +++ b/test/config.ts @@ -1,6 +1,20 @@ +import * as os from "node:os"; + +let lib = "/usr/local/lib/softhsm/libsofthsm2.so"; +switch (os.platform()) { + case "darwin": + lib = "/usr/local/lib/softhsm/libsofthsm2.dylib"; + break; + case "linux": + lib = "/usr/lib/softhsm/libsofthsm2.so"; + break; + default: + throw new Error("Unknown platform"); +} + export default { init: { - lib: "/usr/local/lib/softhsm/libsofthsm2.so", + lib, libName: "SoftHSM", pin: "12345", vendor: "",