From 68a4aafbf284ec2281e1a842177c8fd1386586c1 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Sun, 28 Jan 2024 13:03:59 -0800 Subject: [PATCH] db: use process.env.DB_PATH On our server, we run our application from a read-only filesystem. We need to add a way to configure where our database will be. Signed-off-by: William Casarin --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 355d4b0..98691c1 100755 --- a/src/index.js +++ b/src/index.js @@ -9,7 +9,7 @@ const express = require('express') const debug = require('debug')('api') const { PurpleInvoiceManager } = require('./invoicing') -const ENV_VARS = ["LN_NODE_ID", "LN_NODE_ADDRESS", "LN_RUNE", "LN_WS_PROXY", "DEEPL_KEY"] +const ENV_VARS = ["LN_NODE_ID", "LN_NODE_ADDRESS", "LN_RUNE", "LN_WS_PROXY", "DEEPL_KEY", "DB_PATH"] function check_env() { const missing = [] @@ -30,7 +30,7 @@ function PurpleApi(opts = {}) { check_env() const queue = {} - const db = lmdb.open({ path: '.' }) + const db = lmdb.open({ path: process.env.DB_PATH }) const translations = db.openDB('translations') const accounts = db.openDB('accounts') const pubkeys_to_user_ids = db.openDB('pubkeys_to_user_ids')