Skip to content

Commit

Permalink
chore: allow custom TEE log path (#2616)
Browse files Browse the repository at this point in the history
* Fix TEE log db path

* Enable custom TEE log path

---------

Co-authored-by: Sayo <[email protected]>
  • Loading branch information
batudo and wtfsayo authored Jan 25, 2025
1 parent 30b22ab commit 14a407c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 4 additions & 1 deletion packages/plugin-tee-log/src/services/teeLogService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 14a407c

Please sign in to comment.