From 1d2f8c60646ba2f7b00dfbe9e2072927c31a59dd Mon Sep 17 00:00:00 2001 From: junjiequan Date: Wed, 18 Sep 2024 16:31:28 +0200 Subject: [PATCH] feat: allow the swagger path to be configurable --- README.md | 1 + src/main.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 50e87e5d3..103b8c3fd 100644 --- a/README.md +++ b/README.md @@ -175,6 +175,7 @@ Valid environment variables for the .env file. See [.env.example](/.env.example) | `ES_FIELDS_LIMIT` | number | | The total number of fields in an index. | 1000 | | `ES_REFRESH` | string | | If set to `wait_for`, Elasticsearch will wait till data is inserted into the specified index before returning a response. | false | | `LOGGERS_CONFIG_FILE` | string | | The file name for loggers configuration, located in the project root directory. | "loggers.json" | +| `SWAGGER_PATH` | string | Yes | swaggerPath is the path where the swagger UI will be available| "explorer"| ## Migrating from the old SciCat Backend diff --git a/src/main.ts b/src/main.ts index a8c8aaec8..a499e5ac1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -36,8 +36,9 @@ async function bootstrap() { docExpansion: "none", }, }; + const swaggerPath = process.env.SWAGGER_PATH || "explorer"; - SwaggerModule.setup("explorer", app, document, swaggerOptions); + SwaggerModule.setup(swaggerPath, app, document, swaggerOptions); app.useGlobalPipes( /**