From 056d46bb818441953e23555b409c1c667e0e86be Mon Sep 17 00:00:00 2001 From: Sebastien DUMETZ Date: Mon, 12 Feb 2024 16:53:26 +0100 Subject: [PATCH] define a new EXPERIMENTAL flag for default-disabled features --- package.json | 4 ++-- source/server/utils/config.ts | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index e42af74c..0e8e636c 100644 --- a/package.json +++ b/package.json @@ -3,11 +3,11 @@ "version": "1.0.0", "description": "3D model database and content management system with integrated annotations and stories 3D editor", "scripts": { - "start": "cd source/server/ && npm start", + "start": "cd source/server/ && EXPERIMENTAL=1 npm start", "test": "cd source/server/ && npm test", "build-ui": "cd source/ui && webpack --mode=production", "build-server": "tsc -b source/server", - "watch": "cd source/server && HOT_RELOAD=1 NODE_ENV=development ROOT_DIR=\"../../\" nodemon -e ts,js -w . -w ../ui/webpack.config.js -x ts-node index.ts" + "watch": "cd source/server && HOT_RELOAD=1 NODE_ENV=development EXPERIMENTAL=1 ROOT_DIR=\"../../\" nodemon -e ts,js -w . -w ../ui/webpack.config.js -x ts-node index.ts" }, "author": "Holusion ", "license": "Apache-2.0", diff --git a/source/server/utils/config.ts b/source/server/utils/config.ts index 3c112c14..eef88415 100644 --- a/source/server/utils/config.ts +++ b/source/server/utils/config.ts @@ -21,8 +21,9 @@ const values = { smart_host: ["smtp://localhost", toString], verbose: [false, toBool], + experimental: [false, toBool], /// FEATURE FLAGS /// - enable_document_merge: [false, toBool], + enable_document_merge: [isExperimental, toBool], } as const; @@ -55,6 +56,13 @@ function toBool(s:string):boolean{ return !(!s || s.toLowerCase() === "false" || s == "0"); } +/** + * used to default a value to "false", unless EXPERIMENTAL flag is set + */ +function isExperimental({experimental}: {experimental: boolean}) :boolean{ + return experimental; +} + /** * Parses a set of environment variables into a configuration object */