Skip to content

Commit

Permalink
sync.
Browse files Browse the repository at this point in the history
  • Loading branch information
msamgan committed Oct 17, 2024
2 parents 8cf24ac + 234656f commit a0b2b04
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 12 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to `laravel-env-keys-checker` will be documented in this file.

## v1.4.1 - 2024-10-13

### What's Changed

* Added no progress option by @fkrzski in https://github.com/msamgan/laravel-env-keys-checker/pull/14

### New Contributors

* @fkrzski made their first contribution in https://github.com/msamgan/laravel-env-keys-checker/pull/14

**Full Changelog**: https://github.com/msamgan/laravel-env-keys-checker/compare/v1.4.0...v1.4.1

## v1.4.0 - 2024-10-08

### What's Changed
Expand Down
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@

![image](https://github.com/user-attachments/assets/8f80ef4a-a777-46ed-bc49-e70e3c1bec60)


[![Latest Version on Packagist](https://img.shields.io/packagist/v/msamgan/laravel-env-keys-checker.svg?style=flat-square)](https://packagist.org/packages/msamgan/laravel-env-keys-checker)
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/msamgan/laravel-env-keys-checker/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/msamgan/laravel-env-keys-checker/actions?query=workflow%3Arun-tests+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/msamgan/laravel-env-keys-checker.svg?style=flat-square)](https://packagist.org/packages/msamgan/laravel-env-keys-checker)

This package is used to check if all the keys are available across all the .env files.
This package is useful when you have multiple .env files,
and you want to make sure that all the keys are available across all the .env files.
This package checks if all the keys are available across all the .env files. This package is useful when you have
multiple .env files and want to ensure all the keys are available across all the .env files.

With a team of developers, it is possible that some developers might forget to add the keys they used in their .env file
to the .env.example file or the other way around.
Expand All @@ -20,6 +18,7 @@ to the .env.example file or the other way around.
- [Installation](#installation)
- [Usage](#usage)
- [To check if all the keys are available across all the .env files.](#to-check-if-all-the-keys-are-available-across-all-the-env-files)
- [Options](#options)
- [To check if the .env and other provided files are present in .gitignore.](#to-check-if-the-env-and-other-provided-files-are-present-in-gitignore)
- [In Test](#in-test)
- [To check if all the keys are available across all the .env files.](#to-check-if-all-the-keys-are-available-across-all-the-env-files-1)
Expand Down Expand Up @@ -65,6 +64,15 @@ php artisan vendor:publish --tag="env-keys-checker-config"
php artisan env:keys-check
```

#### Options

``--auto-add``: This option will add the missing keys to the .env files automatically.
The possible values are ``ask``,
``auto``, and ``none``.
The default value is ``ask``.

``--no-progress``: This option will disable the progress bar.

### To check if the .env and other provided files are present in .gitignore.

```bash
Expand Down
21 changes: 13 additions & 8 deletions src/Commands/KeysCheckerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ class KeysCheckerCommand extends Command
{
use HelperFunctions;

public $signature = 'env:keys-check
{--auto-add= : Auto add missing keys to the .env files. Available options: ask, auto, none}';
public $signature = 'env:keys-check {--auto-add=} {--no-progress}';

public $description = 'Check if all keys in .env file are present across all .env files. Like .env, .env.example, .env.testing, etc.';

Expand Down Expand Up @@ -57,12 +56,18 @@ public function handle(GetKeys $getKeys, CheckKeys $checkKeys, AddKeys $addKeys)

$missingKeys = collect();

progress(
label: 'Checking keys...',
steps: $keys,
callback: fn ($key) => $checkKeys->handle(keyData: $key, envFiles: $envFiles, missingKeys: $missingKeys),
hint: 'It won\'t take long.'
);
$processKeys = fn ($key) => $checkKeys->handle(keyData: $key, envFiles: $envFiles, missingKeys: $missingKeys);

if ($this->option('no-progress')) {
$keys->each($processKeys);
} else {
progress(
label: 'Checking keys...',
steps: $keys,
callback: $processKeys,
hint: 'It won\'t take long.'
);
}

if ($missingKeys->isEmpty()) {
$this->showSuccessInfo(
Expand Down

0 comments on commit a0b2b04

Please sign in to comment.