refactor: Refactors AAI PostgreSQL fallback configuration (#541) - #542
Merged
Conversation
## Summary Refactors AAI PostgreSQL fallback configuration to use individual variable fallbacks instead of all-or-nothing HOST checks, making it more flexible and concise. ## Changes - Replace conditional blocks with `||=` logical assignment operator for cleaner syntax - Provide individual fallbacks for each database variable (HOST, PORT, DATABASE, USER, PASSWORD) - Reduce code from 24 lines to 16 lines while improving functionality ## Problem Solved Previously, AAI service fallbacks only worked if the entire HOST variable was missing. This meant: - If `AAI_DEFAULT_POSTGRES_RECORDMANAGER_HOST` was set but `AAI_DEFAULT_POSTGRES_RECORDMANAGER_PORT` was missing, no fallback would occur - Users couldn't selectively override individual variables while keeping others as defaults ## Benefits - ✅ **More flexible**: Each variable can now have its own fallback - ✅ **More concise**: 33% reduction in lines of code - ✅ **Modern syntax**: Uses ES2021 `||=` operator - ✅ **Better maintainability**: Clearer intent and easier to modify - ✅ **Same precedence**: Maintains existing precedence order (Individual AAI secrets > Individual AAI variables > Shared DATABASE_SECRET) ## Testing - [x] Linting passes - [x] No breaking changes to existing functionality - [x] Maintains backward compatibility ## Type of Change - [x] Refactor (non-breaking change that improves code quality)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
maxtechera
temporarily deployed
to
staging - theanswer-iek0
September 15, 2025 19:03 — with
Render
Inactive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactors AAI PostgreSQL fallback configuration to use individual variable fallbacks instead of all-or-nothing HOST checks, making it more flexible and concise.
Changes
||=logical assignment operator for cleaner syntaxProblem Solved
Previously, AAI service fallbacks only worked if the entire HOST variable was missing. This meant:
AAI_DEFAULT_POSTGRES_RECORDMANAGER_HOSTwas set butAAI_DEFAULT_POSTGRES_RECORDMANAGER_PORTwas missing, no fallback would occurBenefits
||=operatorTesting
Type of Change