Skip to content

fix(api): Generate env vars for existing database mode#114

Merged
nfebe merged 1 commit intomainfrom
fix/existing-db-credentials
Mar 29, 2026
Merged

fix(api): Generate env vars for existing database mode#114
nfebe merged 1 commit intomainfrom
fix/existing-db-credentials

Conversation

@nfebe
Copy link
Copy Markdown
Contributor

@nfebe nfebe commented Mar 29, 2026

Require db credentials for existing databases as there is no other way to connect them

@sourceant
Copy link
Copy Markdown

sourceant bot commented Mar 29, 2026

Code Review Summary

The PR correctly implements mandatory credential checks for databases in existing mode. It also ensures that environment variables are properly generated using these credentials and handles default port mapping for common database types.

🚀 Key Improvements

  • Strict validation for database_name, username, and password in existing mode to prevent connection failures.
  • Automated port selection based on database type if external_port is omitted.
  • Comprehensive test coverage for the new validation requirements in internal/api/multi_database_test.go.

💡 Minor Suggestions

  • Standardize error strings between validation logic and test expectations.
  • Encapsulate port mapping logic to reduce code duplication.

Copy link
Copy Markdown

@sourceant sourceant bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. See the overview comment for a summary.

Copy link
Copy Markdown

@sourceant sourceant bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. No specific code suggestions were generated. See the overview comment for a summary.

Copy link
Copy Markdown

@sourceant sourceant bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. See the overview comment for a summary.

Copy link
Copy Markdown

@sourceant sourceant bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. See the overview comment for a summary.

Copy link
Copy Markdown

@sourceant sourceant bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. See the overview comment for a summary.

Copy link
Copy Markdown

@sourceant sourceant bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. No specific code suggestions were generated. See the overview comment for a summary.

@nfebe nfebe force-pushed the fix/existing-db-credentials branch from 3931a87 to e2c2e40 Compare March 29, 2026 22:43
Copy link
Copy Markdown

@sourceant sourceant bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. See the overview comment for a summary.

The existing database path was not generating environment variables
or writing credentials to .env.flatrun. Validation now requires
database_name, username, and password since we lack admin access to
create them on an existing database.

Port defaults are explicit per database type (mysql, mariadb, postgres,
mongodb, redis) with a logged fallback for unknown types. Deployment
name sanitization handles hyphens, dots, and spaces.

Signed-off-by: nfebe <fenn25.fn@gmail.com>
@nfebe nfebe force-pushed the fix/existing-db-credentials branch from e2c2e40 to 7d9d6ef Compare March 29, 2026 22:47
Copy link
Copy Markdown

@sourceant sourceant bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. See the overview comment for a summary.

@nfebe nfebe merged commit 9bdb147 into main Mar 29, 2026
5 checks passed
@nfebe nfebe deleted the fix/existing-db-credentials branch March 29, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant