Skip to content

Refactor: env - #385

Merged
TatevikGr merged 5 commits into
devfrom
env
Jul 29, 2026
Merged

Refactor: env#385
TatevikGr merged 5 commits into
devfrom
env

Conversation

@TatevikGr

@TatevikGr TatevikGr commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Configuration
    • Updated API endpoint configuration to derive the API base from a single environment URL and append /api/v2.
    • Consolidated API base settings under application configuration and removed the dedicated REST API base environment variable.
    • Moved configuration defaults into .env.dist, with runtime values sourced from environment variables.
  • Environment & Bootstrapping
    • Added Symfony Dotenv support to load values from .env during startup.
    • Improved .env generation behavior and updated ignore rules for environment files.
  • Documentation
    • Updated server setup instructions to use .env (generated from .env.dist).

Thanks for contributing to phpList!

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The application now uses .env.dist for configuration defaults, generates .env during Composer configuration, loads dotenv values during bootstrap, and removes inline parameter defaults. API URLs share API_BASE_URL, with the REST API path appended as /api/v2.

Changes

Environment configuration

Layer / File(s) Summary
Dotenv generation and configuration wiring
.env.dist, composer.json, src/Composer/ScriptHandler.php, .gitignore
Adds environment defaults, generates .env from .env.dist, preserves existing .env files, and registers dotenv configuration during Composer updates.
Bootstrap environment loading
src/Core/Bootstrap.php
Loads .env before debugging and application-kernel configuration, setting APP_ENV to the configured environment.
Environment parameter migration
config/parameters.yml.dist, README.md, CHANGELOG.md
Removes inline environment defaults, updates API URL wiring to use API_BASE_URL, and documents .env configuration.Each row should have paths etc.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is related to environment configuration, but it is too vague to describe the actual .env and dotenv integration changes. Use a clearer title like "Add dotenv support for .env configuration" or similar.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch env

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@config/parameters.yml.dist`:
- Around line 37-39: Normalize API_BASE_URL to remove any trailing slash before
appending /api/v2 in app.rest_api_base_url, while preserving app.api_base_url
and downstream URL values without duplicate slashes. Ensure the default
configuration and deployment-provided values follow the same no-trailing-slash
behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a9189fb3-cd53-4927-a570-613d605161a1

📥 Commits

Reviewing files that changed from the base of the PR and between c5efbd8 and 3ef0af5.

📒 Files selected for processing (1)
  • config/parameters.yml.dist

Comment thread config/parameters.yml.dist Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/Core/Bootstrap.php`:
- Around line 165-166: Update the environment-loading logic around Bootstrap so
production does not load the tracked .env.dist fallback when .env is absent.
Require a generated .env file, or inspect the fallback contents and reject it
when PHPLIST_SECRET still contains the unreplaced %s placeholder before invoking
Dotenv::loadEnv. Preserve normal loading for a valid generated .env.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 04ad5282-5997-4940-a98f-291373fea210

📥 Commits

Reviewing files that changed from the base of the PR and between 3ef0af5 and 8a7278d.

📒 Files selected for processing (8)
  • .env.dist
  • .gitignore
  • CHANGELOG.md
  • README.md
  • composer.json
  • config/parameters.yml.dist
  • src/Composer/ScriptHandler.php
  • src/Core/Bootstrap.php

Comment thread src/Core/Bootstrap.php
@TatevikGr
TatevikGr force-pushed the env branch 2 times, most recently from 424c01f to a350de0 Compare July 26, 2026 07:32
@TatevikGr
TatevikGr changed the base branch from main to dev July 29, 2026 17:37
@TatevikGr
TatevikGr merged commit 8d28d3b into dev Jul 29, 2026
8 checks passed
@TatevikGr
TatevikGr deleted the env branch July 29, 2026 17:37
@coderabbitai coderabbitai Bot mentioned this pull request Jul 29, 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.

2 participants