🩹 Load services from configuration rather than hard code in CLI (#438)
This commit is contained in:
committed by
ericlinagora
parent
4869c70bbc
commit
bde7e50779
@@ -1,6 +1,8 @@
|
|||||||
import yargs from "yargs";
|
import yargs from "yargs";
|
||||||
import tdrive from "../../../tdrive";
|
import tdrive from "../../../tdrive";
|
||||||
import ora from "ora";
|
import ora from "ora";
|
||||||
|
|
||||||
|
import config from "../../../core/config";
|
||||||
import { TdrivePlatform } from "../../../core/platform/platform";
|
import { TdrivePlatform } from "../../../core/platform/platform";
|
||||||
import { DatabaseServiceAPI } from "../../../core/platform/services/database/api";
|
import { DatabaseServiceAPI } from "../../../core/platform/services/database/api";
|
||||||
import { Pagination } from "../../../core/platform/framework/api/crud-service";
|
import { Pagination } from "../../../core/platform/framework/api/crud-service";
|
||||||
@@ -88,22 +90,6 @@ class SearchIndexAll {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const services = [
|
|
||||||
"search",
|
|
||||||
"database",
|
|
||||||
"webserver",
|
|
||||||
"auth",
|
|
||||||
"counter",
|
|
||||||
"cron",
|
|
||||||
"message-queue",
|
|
||||||
"push",
|
|
||||||
"realtime",
|
|
||||||
"storage",
|
|
||||||
"tracker",
|
|
||||||
"websocket",
|
|
||||||
"email-pusher",
|
|
||||||
];
|
|
||||||
|
|
||||||
const command: yargs.CommandModule<unknown, unknown> = {
|
const command: yargs.CommandModule<unknown, unknown> = {
|
||||||
command: "index",
|
command: "index",
|
||||||
describe: "command to reindex search middleware from db entities",
|
describe: "command to reindex search middleware from db entities",
|
||||||
@@ -120,10 +106,9 @@ const command: yargs.CommandModule<unknown, unknown> = {
|
|||||||
},
|
},
|
||||||
handler: async argv => {
|
handler: async argv => {
|
||||||
const spinner = ora({ text: "Reindex repository - " }).start();
|
const spinner = ora({ text: "Reindex repository - " }).start();
|
||||||
const platform = await tdrive.run(services);
|
const platform = await tdrive.run(config.get("services"));
|
||||||
await gr.doInit(platform);
|
await gr.doInit(platform);
|
||||||
const migrator = new SearchIndexAll(platform);
|
const migrator = new SearchIndexAll(platform);
|
||||||
|
|
||||||
const repository = (argv.repository || "") as string;
|
const repository = (argv.repository || "") as string;
|
||||||
|
|
||||||
// Let this run even without a repository as its error message includes valid repository names
|
// Let this run even without a repository as its error message includes valid repository names
|
||||||
|
|||||||
Reference in New Issue
Block a user