Disable swagger docs endpoint with environment variable (#4665)
* add option to disable swagger docs via env * update .example.env for docker and server --------- Co-authored-by: Timothy Carambat <rambat1010@gmail.com>
This commit is contained in:
parent
6b1b8bbc94
commit
2e1c1ff891
@ -376,3 +376,7 @@ GID='1000'
|
||||
# This is only required on Linux machines running AnythingLLM via Docker
|
||||
# and do not want to use the --cap-add=SYS_ADMIN docker argument
|
||||
# ANYTHINGLLM_CHROMIUM_ARGS="--no-sandbox,--disable-setuid-sandbox"
|
||||
|
||||
# Disable Swagger API documentation endpoint.
|
||||
# Set to "true" to disable the /api/docs endpoint (recommended for production deployments).
|
||||
# DISABLE_SWAGGER_DOCS="true"
|
||||
@ -379,3 +379,7 @@ TTS_PROVIDER="native"
|
||||
# ENABLE_HTTP_LOGGER=""
|
||||
# This enables timestamps for the HTTP Logger. Set value to a truthy string to enable, leave empty value or comment out to disable.
|
||||
# ENABLE_HTTP_LOGGER_TIMESTAMPS=""
|
||||
|
||||
# Disable Swagger API documentation endpoint.
|
||||
# Set to "true" to disable the /api/docs endpoint (recommended for production deployments).
|
||||
# DISABLE_SWAGGER_DOCS="true"
|
||||
@ -9,6 +9,12 @@ function faviconUrl() {
|
||||
}
|
||||
|
||||
function useSwagger(app) {
|
||||
if (process.env.DISABLE_SWAGGER_DOCS === "true") {
|
||||
console.log(
|
||||
`\x1b[33m[SWAGGER DISABLED]\x1b[0m Swagger documentation is disabled via DISABLE_SWAGGER_DOCS environment variable.`
|
||||
);
|
||||
return;
|
||||
}
|
||||
app.use('/api/docs', swaggerUi.serve);
|
||||
const options = {
|
||||
customCss: [
|
||||
|
||||
Loading…
Reference in New Issue
Block a user