-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Fix(yaml env var): added env var fallback #1300
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
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.
Greptile Summary
This PR introduces a partial fix for environment variable handling in the YAML workflow conversion route. The change adds proper fallback logic for the SIM_AGENT_API_URL environment variable by importing the SIM_AGENT_API_URL_DEFAULT constant and creating a local variable that falls back to the default value when the environment variable is undefined.
The modification addresses a potential runtime issue where the application could fail when making API calls to the sim-agent service if the SIM_AGENT_API_URL environment variable is not configured. According to the environment configuration, this variable is optional, so providing a fallback ensures the application can gracefully default to 'https://agent.sim.ai' in deployment scenarios where this environment variable isn't set.
The change follows the established pattern in the codebase where critical URLs have default fallbacks, ensuring robustness across different deployment environments. This aligns with the application's architecture of supporting multiple deployment configurations while maintaining core functionality.
PR Description Notes:
- The PR description is incomplete with empty Summary, Type of Change, and Testing sections
- All checklist items remain unchecked
Confidence score: 2/5
- This PR introduces an incomplete fix that creates inconsistent behavior within the same file
- Score reflects the partial implementation where only one of two usages of the same environment variable was updated (line 295 fixed, line 96 still vulnerable)
- Pay close attention to
apps/sim/app/api/workflows/[id]/yaml/route.tsas it contains inconsistent environment variable usage that could cause runtime errors
1 file reviewed, no comments
e036046 to
825b455
Compare
* added env var to route * lint --------- Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net>
* added env var to route * lint --------- Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net>
Summary
Follow other uses of SIM_AGENT_API_URL to allow easier local testing.
Testing
Manually
Checklist