Skip to content

Conversation

tuj
Copy link
Contributor

@tuj tuj commented Sep 6, 2025

Issue

#249

Description

  • Added command to migrate config.json files to .env variables.
  • Expanded upgrade guide.

Checklist

  • My code is covered by test cases.
  • My code passes our test (all our tests).
  • My code passes our static analysis suite.
  • My code passes our continuous integration process.

@tuj tuj added this to the 3.0.0 milestone Sep 6, 2025
@tuj tuj self-assigned this Sep 6, 2025
@tuj tuj added the enhancement New feature or request label Sep 6, 2025
@tuj tuj changed the base branch from develop to release/3.0.0 September 6, 2025 08:28
@tuj tuj requested a review from turegjorup September 6, 2025 08:47
@tuj tuj mentioned this pull request Sep 6, 2025
35 tasks
Copy link
Contributor

@turegjorup turegjorup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions in comments.

Most important is the issue of default values. The convention for .env[.*] in Symfony applications is that default values are defined in .env and overrides in .env.local.

This command defines defaults and asks that you set them in .env.local. It would be better to only give out put for lines with values set. If no value is set, the variable should be omitted to allow fallback to defaults in .env


$content = file_get_contents($input->getArgument('filepath'));

$config = json_decode($content, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use JSON_THROW_ON_ERROR to force an exception if json not valid. Then add error/command failed

return Command::INVALID;
}

$content = file_get_contents($input->getArgument('filepath'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try/catch when reading file

}

$env = "###> Admin configuration ###\n";
$env .= 'ADMIN_REJSEPLANEN_APIKEY="'.$rejseplanenApiKey."\"\n";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why output ADMIN_REJSEPLANEN_APIKEY if it's empty?

$env .= 'ADMIN_ENHANCED_PREVIEW='.$enhancedPreview."\n";
$env .= "###< Admin configuration ###\n";

$output->writeln($env);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be better to just $output->writeln() one line at a time instead of building a multi line variable.
(Don't know how new line works in the console across platforms, but normally you should use PHP_EOLto match the platform. Recommend letting $output->writeln() handle line breaks.)

$env .= 'CLIENT_DEBUG='.$debug."\n";
$env .= "###< Client configuration ###\n";

$output->writeln($env);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above about multi lines

@tuj tuj requested a review from turegjorup September 8, 2025 13:26
Copy link
Contributor

@turegjorup turegjorup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should potentially target the 2.* branch so that you can run it prior to upgrading to 3.0

@tuj tuj merged commit 078f0c8 into release/3.0.0 Sep 16, 2025
17 checks passed
@tuj tuj deleted the feature/upgrade-guide branch September 16, 2025 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants