Skip to content

Commit

Permalink
define a new EXPERIMENTAL flag for default-disabled features
Browse files Browse the repository at this point in the history
  • Loading branch information
sdumetz committed Feb 12, 2024
1 parent ac4e8d2 commit 056d46b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>",
"license": "Apache-2.0",
Expand Down
10 changes: 9 additions & 1 deletion source/server/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
*/
Expand Down

0 comments on commit 056d46b

Please sign in to comment.