From 263e7918a72fe5296cdaec50af221aee7184f735 Mon Sep 17 00:00:00 2001 From: Enzo Cioppettini <48031343+ecioppettini@users.noreply.github.com> Date: Fri, 3 May 2024 19:49:39 -0300 Subject: [PATCH] add command to print the json schema of the config --- .../engine/paima-standalone/src/utils/input.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/engine/paima-standalone/src/utils/input.ts b/packages/engine/paima-standalone/src/utils/input.ts index 99c670107..9a6f16e47 100644 --- a/packages/engine/paima-standalone/src/utils/input.ts +++ b/packages/engine/paima-standalone/src/utils/input.ts @@ -17,6 +17,7 @@ import { import { importOpenApiJson, importTsoaFunction } from './import.js'; import type { Template } from './types.js'; import RegisterRoutes, { EngineService } from '@paima/rest'; +import { BaseConfigWithoutDefaults } from '@paima/utils/src/config/loading.js'; // Prompt user for input in the CLI export const userPrompt = (query: string): Promise => { @@ -64,6 +65,10 @@ export const argumentRouter = async (): Promise => { batcherCommand(); break; + case 'gen-config-json-schema': + genConfigSchemaCommand(); + break; + default: helpCommand(); } @@ -167,6 +172,7 @@ export const helpCommand = (): void => { doLog(` help Shows list of commands currently available.`); doLog(` version Shows the version of used paima-engine.`); doLog(` batcher Saves the bundled batcher project to your local filesystem.`); + doLog(` gen-config-json-schema Prints the JSON Schema for the engine configuration.`); }; // Batcher command logic @@ -174,6 +180,10 @@ export const batcherCommand = (): void => { prepareBatcher(); }; +export const configJsonSchema = (): void => { + genConfigSchemaCommand(); +}; + // Build middleware for specific .env file and launch webserver: const startWebServer = (): Promise => new Promise((resolve, reject) => { @@ -249,3 +259,7 @@ const pickGameTemplate = async (templateArg: string): Promise