beyondcode / beyondcode/laravel-self-diagnosis

Check ExampleEnvironmentVariablesAreSet doesn't check actual environment variables

Open
#83 1 comment 10 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
1.5k
Forks
107
PR merge metrics
No merged PRs in 30d

Description

### What

The check `ExampleEnvironmentVariablesAreSet` only compares the `.env.example` with the `.env` file. It would make sense to check if actual environment variables are set too.

### Why

We're running a laravel project in Kubernetes. In the production container there is no .env file, but instead the environment variables are set on the container directly. We want to run the `ExampleEnvironmentVariablesAreSet` as "init container" to be sure that the container doesn't start with missing environment variables.

### Proposed fix

Also check the actual environment variables (`getenv()`), don't just compare the `.env` file.

Contributor guide

Open the contributing guide

Research direction

Start at the ExampleEnvironmentVariablesAreSet check described in the issue and trace how it currently compares .env.example with .env. Inspect how getenv() exposes container environment variables, then verify that the check reports missing values when no .env file exists but required variables are set directly in the environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.