Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert 'Use real path for .env.local' #6171

Merged
merged 3 commits into from Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -108,7 +108,7 @@
"symfony/event-dispatcher": "^5.4",
"symfony/event-dispatcher-contracts": "^2.0 || ^3.0",
"symfony/expression-language": "^5.4",
"symfony/filesystem": "^5.4",
"symfony/filesystem": "^5.4.25",
"symfony/finder": "^5.4",
"symfony/framework-bundle": "^5.4",
"symfony/http-client": "^5.4",
Expand Down
2 changes: 1 addition & 1 deletion manager-bundle/composer.json
Expand Up @@ -42,7 +42,7 @@
"symfony/dotenv": "^5.4",
"symfony/error-handler": "^5.4",
"symfony/expression-language": "^5.4",
"symfony/filesystem": "^5.4",
"symfony/filesystem": "^5.4.25",
"symfony/finder": "^5.4",
"symfony/framework-bundle": "^5.4",
"symfony/http-client": "^5.4",
Expand Down
8 changes: 1 addition & 7 deletions manager-bundle/src/Command/ContaoSetupCommand.php
Expand Up @@ -73,14 +73,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
// Auto-generate a kernel secret if none was set
if (empty($this->kernelSecret) || 'ThisTokenIsNotSoSecretChangeIt' === $this->kernelSecret) {
$filesystem = new Filesystem();
$localPath = Path::join($this->projectDir, '.env.local');

// Get the realpath in case it is a symlink (see #6066)
if ($realpath = realpath($localPath)) {
$localPath = $realpath;
}

$dotenv = new DotenvDumper($localPath, $filesystem);
$dotenv = new DotenvDumper(Path::join($this->projectDir, '.env.local'), $filesystem);
$dotenv->setParameter('APP_SECRET', bin2hex(random_bytes(32)));
$dotenv->dump();

Expand Down
11 changes: 2 additions & 9 deletions manager-bundle/src/ContaoManager/ApiCommand/SetDotEnvCommand.php
Expand Up @@ -48,21 +48,14 @@ protected function configure(): void

protected function execute(InputInterface $input, OutputInterface $output): int
{
$filesystem = new Filesystem();
$path = Path::join($this->projectDir, '.env');
$localPath = $path.'.local';

// Get the realpath in case it is a symlink (see #6066)
if ($realpath = realpath($localPath)) {
$localPath = $realpath;
}

$dumper = new DotenvDumper($localPath, $filesystem);
$dumper = new DotenvDumper($path.'.local');
$dumper->setParameter($input->getArgument('key'), $input->getArgument('value'));
$dumper->dump();

if (!file_exists($path)) {
$filesystem->touch($path);
(new Filesystem())->touch($path);
}

return 0;
Expand Down