Skip to content

Move hardcoded configuration to environment variables#46

Merged
hassan689 merged 3 commits into
mainfrom
copilot/refactor-config-to-env-vars
Jan 15, 2026
Merged

Move hardcoded configuration to environment variables#46
hassan689 merged 3 commits into
mainfrom
copilot/refactor-config-to-env-vars

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 15, 2026

Several configuration values were hardcoded in app_constants.dart and points.dart, requiring code changes to modify settings.

Changes

Configuration extraction:

  • Notification settings (channel ID, name, description, icon)
  • LED timing (on/off durations)
  • Map distance threshold for proximity detection

Implementation:

  • Added environment variable getters to AppConfig with fallback defaults
  • Refactored AppConstants from static constants to getters delegating to AppConfig
  • Updated .env.example with new variables and documentation
  • Removed const modifiers in notification_service.dart where values are now runtime-evaluated
// Before
static const String notificationChannelId = 'high_importance_channel';
static const double _nearDistanceThreshold = 5000;

// After
static String get notificationChannelId => AppConfig.notificationChannelId;
double get _nearDistanceThreshold => AppConfig.nearDistanceThreshold;

All values maintain existing defaults when .env is absent. Commission rates were already environment-driven.

Original prompt

This section details on the original issue you should resolve

<issue_title>Hardcoded Configuration Values Instead of Environment Variables</issue_title>
<issue_description>

🟡 Medium Priority Issue

Problem

Some configuration values are hardcoded in the code instead of using environment variables, reducing flexibility.

Examples

  • Default commission rates in app_config.dart:184,193
  • Some Firebase configuration might be hardcoded
  • Default values that should be configurable

Impact

  • Less flexible configuration
  • Requires code changes to modify settings
  • Not following 12-factor app principles

Expected Behavior

All configurable values should be in environment variables with sensible defaults.

Solution

Move hardcoded values to environment variables:

  1. Add to .env.example
  2. Update app_config.dart to read from environment
  3. Provide sensible defaults

Additional Context

The app already uses environment variables for most configuration, but some values are still hardcoded.

---</issue_description>

<agent_instructions>solve the isssue to make th dcode more bettter </agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 15, 2026 12:57
…bles

Co-authored-by: hassan689 <117458014+hassan689@users.noreply.github.com>
…tters

Co-authored-by: hassan689 <117458014+hassan689@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor hardcoded configuration values to use environment variables Move hardcoded configuration to environment variables Jan 15, 2026
Copilot AI requested a review from hassan689 January 15, 2026 13:00
@hassan689 hassan689 marked this pull request as ready for review January 15, 2026 13:33
@hassan689 hassan689 merged commit 62daa58 into main Jan 15, 2026
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.

Hardcoded Configuration Values Instead of Environment Variables

2 participants