Skip to content

Commit

Permalink
fix: config setup onboarding(#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthv committed Feb 1, 2023
1 parent bc7bbc3 commit 0e246ae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
File renamed without changes.
8 changes: 6 additions & 2 deletions src/Command/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,13 @@ private function addKeysToEnvFile(OutputInterface $output, array $keys, string $

private function publishConfig(OutputInterface $output)
{
$defaultConfigFile = __DIR__ . '/../../config/default.config';
$publishFileName = $this->appKernel->getProjectDir() . '/config/packages/symfony_forest_admin.php';
$defaultConfigFile = __DIR__ . '/../../default.config';
$publishFileName = $this->appKernel->getProjectDir() . '/forest/symfony_forest_admin.php';
if (! file_exists($publishFileName)) {
$forestDirectory = $this->appKernel->getProjectDir() . '/forest';
if (! mkdir($forestDirectory) && ! is_dir($forestDirectory)) {
throw new \RuntimeException(sprintf('Directory "%s" was not created', $forestDirectory));
}
copy($defaultConfigFile, $publishFileName);
$output->writeln('<info>✅ Config file set</info>');
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/Service/ForestAgent.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public function __construct(private KernelInterface $appKernel, private EntityMa

private function loadConfiguration(): void
{
if (file_exists($this->appKernel->getProjectDir() . '/config/packages/symfony_forest_admin.php')) {
$callback = require $this->appKernel->getProjectDir() . '/config/packages/symfony_forest_admin.php';
if (file_exists($this->appKernel->getProjectDir() . '/forest/symfony_forest_admin.php')) {
$callback = require $this->appKernel->getProjectDir() . '/forest/symfony_forest_admin.php';
$callback($this);
}
}
Expand Down

0 comments on commit 0e246ae

Please sign in to comment.