fix: centralized secret loading for preflight checks (#554)#696
fix: centralized secret loading for preflight checks (#554)#696CodeWithCJ merged 4 commits intomainfrom
Conversation
- Add secretLoader utility to resolve _FILE env vars into process.env - Integrate secret loading into server entry point before preflight - Simplify encryption.js by removing redundant local secret retrieval
Summary of ChangesHello @CodeWithCJ, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the server's secret management by centralizing the loading of secrets from files, which is crucial for containerized deployments like Docker Swarm and Kubernetes. This change streamlines the server startup process, ensuring that all necessary secrets are available before critical services and preflight checks are executed. Additionally, it refines the food database's sorting logic to provide more consistent and predictable results for paginated queries. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a centralized secretLoader utility to handle environment variables that reference secret files, which is a robust improvement for managing secrets, especially in containerized environments. The encryption.js file has been simplified by removing its local secret retrieval logic, now relying on the new utility. Additionally, the food sorting logic in food.js has been enhanced to provide more stable and predictable sorting by including f.id ASC as a tie-breaker and NULLS LAST for nutrition fields, with corresponding test updates. Minor formatting adjustments were also made across several files to improve readability.
| `; | ||
|
|
||
| let orderByClause = "f.name ASC"; | ||
| let orderByClause = "f.name ASC, f.id ASC"; |
| ) { | ||
| if (nutritionSortFields.includes(sortField)) { | ||
| orderByClause = `fv.${sortField} ${sortOrder.toUpperCase()}, f.name ASC`; | ||
| orderByClause = `fv.${sortField} ${sortOrder.toUpperCase()} NULLS LAST, f.name ASC, f.id ASC`; |
There was a problem hiding this comment.
Adding NULLS LAST to the ORDER BY clause for nutrition fields (like fv.calories) is a significant improvement. It ensures that foods with NULL values for these fields are consistently placed at the end of the sorted list, preventing unpredictable ordering and improving data presentation. The inclusion of f.id ASC as a secondary sort key further enhances stability.
fix: centralized secret loading for preflight checks (#554)