27 lines
886 B
PHP
27 lines
886 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Support\Release\FeatureFlagRegistry;
|
|
use Illuminate\Console\Command;
|
|
use Illuminate\Support\Facades\File;
|
|
|
|
final class ReleaseFeatureFlagsCommand extends Command
|
|
{
|
|
protected $signature = 'app:release-feature-flags {--format=json}';
|
|
protected $description = 'Export modular rollout feature flag map.';
|
|
|
|
public function handle(FeatureFlagRegistry $registry): int
|
|
{
|
|
$data = ['flags' => $registry->export()];
|
|
$path = storage_path('app/generated/release-feature-flags.json');
|
|
File::ensureDirectoryExists(dirname($path));
|
|
File::put($path, json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
|
|
|
$this->info('Feature flag rollout map written to '.$path);
|
|
$this->line(json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
}
|