fix(server): trim show community nodes env#6143
fix(server): trim show community nodes env#6143suyua9 wants to merge 2 commits intoFlowiseAI:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a parseBooleanEnv helper function to standardize environment variable parsing, specifically handling whitespace trimming and case-insensitive boolean checks. It also adds comprehensive unit tests for these scenarios. The review feedback suggests using a loose equality check (== null) in the helper function to more robustly handle both null and undefined values, which is a common idiom in TypeScript.
packages/server/src/AppConfig.ts
Outdated
| if (value === undefined) { | ||
| return defaultValue | ||
| } |
There was a problem hiding this comment.
According to the project's general rules, loose equality (== null) should be used as a standard idiom for nullish checks to cover both null and undefined. This is more idiomatic in this codebase and also makes the helper function more robust if it's ever used with values that could be null.
| if (value === undefined) { | |
| return defaultValue | |
| } | |
| if (value == null) { | |
| return defaultValue | |
| } |
References
- In JavaScript/TypeScript, use loose equality (== null) as a standard idiom for a 'nullish' check that covers both null and undefined.
|
Addressing the Gemini follow-up in the existing PR branch.
Local validation in this checkout is still limited to |
Summary
SHOW_COMMUNITY_NODESbefore parsing it as a booleanTesting
git diff --check -- packages/server/src/AppConfig.ts packages/server/src/AppConfig.test.tspnpm --dir /Users/ming/code/Flowise/packages/server test -- --runInBand src/AppConfig.test.ts(fails in this checkout becausepackages/server/node_modulesis missing andjestis not installed locally)