From c5421ad8605ecb5a69297e303d773dd3d6a75d3a Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 6 Oct 2022 12:18:35 +0530 Subject: [PATCH] fix(api): disable external project creation in api level Signed-off-by: Pranav C --- packages/nocodb/src/lib/meta/api/projectApis.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/nocodb/src/lib/meta/api/projectApis.ts b/packages/nocodb/src/lib/meta/api/projectApis.ts index 177d70b931..75ca810f80 100644 --- a/packages/nocodb/src/lib/meta/api/projectApis.ts +++ b/packages/nocodb/src/lib/meta/api/projectApis.ts @@ -55,7 +55,11 @@ export async function projectUpdate( 'color', ]); - if (data?.title && project.title !== data.title && await Project.getByTitle(data.title)) { + if ( + data?.title && + project.title !== data.title && + (await Project.getByTitle(data.title)) + ) { NcError.badRequest('Project title already in use'); } @@ -114,6 +118,9 @@ async function projectCreate(req: Request, res) { }, ]; } else { + if (process.env.NC_CONNECT_TO_EXTERNAL_DB_DISABLED) { + NcError.badRequest('Connecting to external db is disabled'); + } projectBody.is_meta = false; }