mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
⚡ Allow to disable public api via env variable
This commit is contained in:
parent
02d7958ea4
commit
0a383ed7c4
|
@ -577,6 +577,12 @@ export const schema = {
|
|||
},
|
||||
|
||||
publicApiEndpoints: {
|
||||
disable: {
|
||||
format: Boolean,
|
||||
default: false,
|
||||
env: 'N8N_PUBLIC_API_DISABLE',
|
||||
doc: 'Whether to disable the Public API',
|
||||
},
|
||||
path: {
|
||||
format: String,
|
||||
default: 'api',
|
||||
|
|
|
@ -581,8 +581,9 @@ class App {
|
|||
return ResponseHelper.sendSuccessResponse(res, {}, true, 204);
|
||||
});
|
||||
|
||||
this.app.use(`/${this.publicApiEndpoint}`, ...(await loadPublicApiVersions()));
|
||||
|
||||
if (!config.getEnv('publicApiEndpoints.disable')) {
|
||||
this.app.use(`/${this.publicApiEndpoint}`, ...(await loadPublicApiVersions()));
|
||||
}
|
||||
// Parse cookies for easier access
|
||||
this.app.use(cookieParser());
|
||||
|
||||
|
|
Loading…
Reference in a new issue