mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-07 14:28:09 +03:00
feat: bootstrap containerisation
insane laughter ensues
This commit is contained in:
@@ -2,13 +2,14 @@
|
||||
import { SetIndexes } from "../external/mongo/indexes";
|
||||
import { Command } from "commander";
|
||||
import CreateLogCtx from "lib/logger/logger";
|
||||
import { ServerConfig } from "lib/setup/config";
|
||||
import { WrapScriptPromise } from "utils/misc";
|
||||
|
||||
const program = new Command();
|
||||
|
||||
const logger = CreateLogCtx(__filename);
|
||||
|
||||
program.requiredOption("-d, --db <database>", "The database to index.");
|
||||
program.option("-d, --db <database>", "The database to index.");
|
||||
program.option(
|
||||
"-r, --reset",
|
||||
"Whether to reset all indexes on this database before indexing or not."
|
||||
@@ -17,6 +18,10 @@ program.option(
|
||||
program.parse(process.argv);
|
||||
const options: { db: string; reset?: boolean } = program.opts();
|
||||
|
||||
if (!options.db) {
|
||||
options.db = ServerConfig.MONGO_DATABASE_NAME;
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
WrapScriptPromise(SetIndexes(options.db, options.reset === true), logger);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user