-
Notifications
You must be signed in to change notification settings - Fork 8.2k
feat: Add .env file support to Windows build scripts #9214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…from .env file 🔧 (build_and_run.ps1): add support for loading environment variables from .env file
…nment variables 🐛 (build_and_run.ps1): fix path to .env file to correctly load environment variables
…pass to langflow run 🔧 (build_and_run.ps1): set env file parameter if .env file exists to pass to langflow run
…v file path for Langflow run 📝 (build_and_run.ps1): enhance script to dynamically locate and set .env file path for Langflow run
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe Windows batch ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Possibly related PRs
Suggested labels
Suggested reviewers
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
scripts/windows/build_and_run.bat(3 hunks)scripts/windows/build_and_run.ps1(4 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-07-18T18:25:54.486Z
Learning: Starter project files auto-format after langflow run; these formatting changes can be committed or ignored
Learnt from: namastex888
PR: langflow-ai/langflow#9018
File: src/frontend/src/modals/apiModal/utils/get-curl-code.tsx:139-184
Timestamp: 2025-07-11T21:32:57.160Z
Learning: In TypeScript/JavaScript cURL code generation for Langflow, PowerShell commands must use backticks (`) for line continuation and follow the pattern: `curl --request POST \` followed by `--url`, `--header` flags on separate lines. Unix commands use backslashes (\) for line continuation. File upload commands should maintain platform-specific formatting just like other cURL commands in the codebase.
scripts/windows/build_and_run.bat (2)
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-07-18T18:25:54.486Z
Learning: Starter project files auto-format after langflow run; these formatting changes can be committed or ignored
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-07-18T18:27:12.609Z
Learning: Frontend builds should output static files to src/frontend/dist/ for production deployment.
scripts/windows/build_and_run.ps1 (2)
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/backend_development.mdc:0-0
Timestamp: 2025-07-18T18:25:54.486Z
Learning: Starter project files auto-format after langflow run; these formatting changes can be committed or ignored
Learnt from: CR
PR: langflow-ai/langflow#0
File: .cursor/rules/frontend_development.mdc:0-0
Timestamp: 2025-07-18T18:27:12.609Z
Learning: Frontend builds should output static files to src/frontend/dist/ for production deployment.
🔇 Additional comments (3)
scripts/windows/build_and_run.ps1 (1)
5-16: Path resolution and parameter construction look solid.The PowerShell implementation correctly uses
Split-Path,Resolve-Path, andJoin-Pathfor robust path handling. The parameter construction with proper quoting handles paths with spaces correctly.scripts/windows/build_and_run.bat (2)
88-92: Conditional execution logic is correct.The batch file correctly uses
if defined ENV_FILE_PARAMto conditionally include the environment file parameter, which is the appropriate way to check for variable existence in batch files.
4-15: PowerShell and Batch .env Handling Are In SyncI’ve verified that both scripts perform the same steps:
- Resolve the project root
- Check for the existence of
.envin that root- Set an environment-file parameter when present
- Invoke
uv run langflow runwith or without the--env-fileflagNo behavioral discrepancies were found. No changes required.
•
scripts/windows/build_and_run.ps1
•scripts/windows/build_and_run.bat
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…ile' instead of a string variable 'envFileParam' to improve readability and maintainability 🔧 (build_and_run.ps1): update uvicorn command to use '--env-file' flag directly instead of building the command with a string variable
…low into cz/load-env-win-script
|
* 🔧 (build_and_run.bat): add support for loading environment variables from .env file 🔧 (build_and_run.ps1): add support for loading environment variables from .env file * 🐛 (build_and_run.bat): fix path to .env file to correctly load environment variables 🐛 (build_and_run.ps1): fix path to .env file to correctly load environment variables * 🔧 (build_and_run.bat): set env file parameter if .env file exists to pass to langflow run 🔧 (build_and_run.ps1): set env file parameter if .env file exists to pass to langflow run * 📝 (build_and_run.bat): improve script to dynamically find and set .env file path for Langflow run 📝 (build_and_run.ps1): enhance script to dynamically locate and set .env file path for Langflow run * Update scripts/windows/build_and_run.bat Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * 🔧 (build_and_run.ps1): refactor script to use a boolean flag 'useEnvFile' instead of a string variable 'envFileParam' to improve readability and maintainability 🔧 (build_and_run.ps1): update uvicorn command to use '--env-file' flag directly instead of building the command with a string variable --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>



This pull request enhances the Windows build and run scripts for Langflow by adding support for
.envfiles. The scripts now automatically detect and use a.envfile if it exists, or fall back to default configurations if it does not. This improvement ensures better configuration management for the application.Enhancements to
.envfile handling:Batch script (
scripts/windows/build_and_run.bat):.envfile in the project root directory and set an--env-fileparameter if the file is found. If the file is not found, a message is displayed, and the script uses the default configuration.uv run langflow run) to include the--env-fileparameter when applicable.PowerShell script (
scripts/windows/build_and_run.ps1):.envfile and set the--env-fileparameter dynamically. Informative messages are displayed based on whether the file is found.--env-fileparameter.Summary by CodeRabbit
New Features
Chores