From 14a407c1832fb3b68b747d0e1cc3e75c37e5694a Mon Sep 17 00:00:00 2001 From: Batudo <82539708+batudo@users.noreply.github.com> Date: Sat, 25 Jan 2025 05:39:50 -0300 Subject: [PATCH] chore: allow custom TEE log path (#2616) * Fix TEE log db path * Enable custom TEE log path --------- Co-authored-by: Sayo --- .env.example | 1 + packages/plugin-tee-log/src/services/teeLogService.ts | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index c1adb3003e4..abe89b0fae5 100644 --- a/.env.example +++ b/.env.example @@ -445,6 +445,7 @@ SQUID_API_THROTTLE_INTERVAL=1000 # Default: 1000; Used to throttle API calls to # Defaults to OFF if not specified TEE_MODE=OFF # LOCAL | DOCKER | PRODUCTION WALLET_SECRET_SALT= # ONLY define if you want to use TEE Plugin, otherwise it will throw errors +TEE_LOG_DB_PATH= # Custom path for TEE Log database, default: ./data/tee_log.sqlite # TEE Verifiable Log Configuration VLOG= # true/false; if you want to use TEE Verifiable Log, set this to "true" diff --git a/packages/plugin-tee-log/src/services/teeLogService.ts b/packages/plugin-tee-log/src/services/teeLogService.ts index fd804d552b4..eb1a730c656 100644 --- a/packages/plugin-tee-log/src/services/teeLogService.ts +++ b/packages/plugin-tee-log/src/services/teeLogService.ts @@ -7,7 +7,7 @@ import Database from "better-sqlite3"; import path from "path"; export class TeeLogService extends Service implements ITeeLogService { - private readonly dbPath = path.resolve("agent/data/tee_log.sqlite"); + private dbPath: string; private initialized = false; private enableTeeLog = false; @@ -62,6 +62,9 @@ export class TeeLogService extends Service implements ITeeLogService { throw new Error("Invalid TEE configuration."); } + const dbPathSetting = runtime.getSetting("TEE_LOG_DB_PATH"); + this.dbPath = dbPathSetting || path.resolve("data/tee_log.sqlite"); + const db = new Database(this.dbPath); this.teeLogDAO = new SqliteTeeLogDAO(db); await this.teeLogDAO.initialize();