Add local scrape database mode and schema
This commit is contained in:
@@ -36,6 +36,7 @@ export function loadConfig({ configPath = "config/local.json", dryRun } = {}) {
|
||||
name: env.DB_NAME || config.database?.name || "catalog_maker_test",
|
||||
user: env.DB_USER || config.database?.user || "catalog_maker",
|
||||
password: env.DB_PASSWORD || config.database?.password || "",
|
||||
scrapeName: env.SCRAPE_DB_NAME || config.database?.scrapeName || "catalog_scrape",
|
||||
connectionLimit: Number(env.DB_CONNECTION_LIMIT || config.database?.connectionLimit || 5),
|
||||
},
|
||||
};
|
||||
|
||||
+3
-1
@@ -195,6 +195,7 @@ function getStatus() {
|
||||
database: {
|
||||
driver: config.database.driver,
|
||||
mode: config.database.mode,
|
||||
scrapeName: config.database.scrapeName,
|
||||
allowWrites: config.database.driver === "mariadb" && config.database.mode === "local" && config.database.allowWrites,
|
||||
},
|
||||
workbook: path.basename(config.sourceWorkbook),
|
||||
@@ -212,7 +213,8 @@ function getStatus() {
|
||||
}
|
||||
|
||||
function getRequestConfig(request) {
|
||||
const selectedMode = String(request.headers["x-database-mode"] || config.database.mode).toLowerCase();
|
||||
const requestedMode = String(request.headers["x-database-mode"] || config.database.mode).toLowerCase();
|
||||
const selectedMode = requestedMode === "scrape" ? "local" : requestedMode;
|
||||
|
||||
if (selectedMode === "local" && config.database.driver !== "mariadb") {
|
||||
throw new Error("Local DB is selected, but MariaDB is not configured. Live DB was not used.");
|
||||
|
||||
Reference in New Issue
Block a user