fix: storage path was not pointing to /data

This commit is contained in:
Shahrad Elahi
2024-03-20 08:44:51 +03:30
parent 399fb0659d
commit 626380c1f7
4 changed files with 55 additions and 12 deletions

9
web/src/lib/env.ts Normal file
View File

@@ -0,0 +1,9 @@
import { createEnv } from '@t3-oss/env-core';
import { z } from 'zod';
export const env = createEnv({
runtimeEnv: process.env,
server: {
STORAGE_PATH: z.string().default('/data/storage.pack'),
},
});

View File

@@ -1,8 +1,8 @@
import { Client, MSGPack } from '@litehex/storage-box';
import { FsDriver } from '@litehex/storage-box/driver';
import { Client, FsDriver, MSGPack } from '@litehex/storage-box';
import { resolve } from 'node:path';
import { env } from '$lib/env';
const storagePath = resolve(process.cwd(), 'storage.pack');
const storagePath = resolve(env.STORAGE_PATH);
const driver = new FsDriver(storagePath, { parser: MSGPack });
export const client = new Client(driver);