writeln('Variáveis de Ambiente (.env):');
$envFile = dirname(__DIR__, 3) . '/.env';
if (!file_exists($envFile)) {
$output->writeln('Arquivo .env não encontrado.');
return Command::FAILURE;
}
$table = new Table($output);
$table->setHeaders(['Variável', 'Valor']);
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach ($lines as $line) {
// Ignorar comentários
if (str_starts_with(trim($line), '#')) {
continue;
}
if (str_contains($line, '=')) {
[$key, $value] = explode('=', $line, 2);
// Ocultar senhas e chaves sensíveis por segurança
if (preg_match('/(PASSWORD|SECRET|KEY|TOKEN)/i', $key)) {
$value = '********';
}
$table->addRow([trim($key), trim($value, '"\' ')]);
}
}
$table->render();
return Command::SUCCESS;
}
}