Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

refactor(config): enhance AppConfig with environment-aware configurat... #106

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

Merged
fulleni merged 4 commits into main from refactor/environment-aware-configurations
Oct 24, 2025

Conversation

@fulleni
Copy link
Member

@fulleni fulleni commented Oct 24, 2025
edited
Loading

Status

READY

Description

This pull request significantly refactors the application's configuration management by introducing environment-aware settings. It leverages Dart's compile-time variables to define API base URLs and the overall application environment, ensuring greater flexibility and robustness across different deployment stages. The changes enhance build safety, especially for production, by enforcing the presence of critical configuration parameters.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

...ions
- Add production() factory constructor with compile-time BASE_URL
- Update development() to use localhost or compile-time BASE_URL
- Remove unused demo() constructor
- Enhance main.dart to support environment-based app initialization
Copy link

Summary of Changes

Hello @fulleni, 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 refactors the application's configuration management by introducing environment-aware settings. It leverages Dart's compile-time variables to define API base URLs and the overall application environment, ensuring greater flexibility and robustness across different deployment stages. The changes enhance build safety, especially for production, by enforcing the presence of critical configuration parameters.

Highlights

  • Environment-aware Configuration: The AppConfig class has been enhanced to dynamically load environment-specific configurations, primarily baseUrl, using compile-time variables.
  • Production Build Safety: The AppConfig.production factory now includes a crucial check that throws a FormatException if the BASE_URL compile-time variable is not provided, preventing production builds with missing API configurations.
  • Flexible Development Setup: The AppConfig.development factory now supports defining the BASE_URL via a compile-time variable, with a sensible default of http://localhost:8080 if not explicitly set.
  • Dynamic Environment Selection: The appEnvironment in main.dart is now determined at compile-time using the APP_ENVIRONMENT variable, allowing for easy switching between production, development, and demo modes.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a great step towards making the application's configuration more robust and environment-aware by using compile-time variables. I've identified a couple of critical issues where String.fromEnvironment is used incorrectly within a const context, which would likely cause compilation errors. I've provided suggestions to fix these. Additionally, I've included a recommendation to refactor the environment selection logic in main.dart for better readability and efficiency, and another to use a more semantically correct exception type in app_config.dart.

- Replace outdated information about environment configuration
- Explain production-ready environment tooling using --dart-define
- Highlight error-proof configuration and advantages
- Improve readability and clarity of the description
- Removed CHANGELOG.md file as it will be replaced by conventional-changelog
- This change allows us to maintain a more dynamic and automated changelog
...variable check
- Replace FormatException with StateError for more appropriate error handling
- Remove unnecessary empty line at the beginning of the file
- Adjust spacing in the thrown error message for better readability
@fulleni fulleni merged commit 3c03aa3 into main Oct 24, 2025
1 check failed
@fulleni fulleni deleted the refactor/environment-aware-configurations branch October 24, 2025 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer

@gemini-code-assist gemini-code-assist[bot] gemini-code-assist[bot] left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /