Skip to content

Commit

Permalink
fix: wrong paths when using default folder structure
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardBaumrock committed Jul 2, 2024
1 parent c89d568 commit 0f1c509
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
35 changes: 13 additions & 22 deletions App/Commands/PwSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,20 @@ public function handle()
}

// add config-local.php
$split = !is_file($this->wire()->config->paths->site . "config-local.php");
if ($split and $this->confirm("Split config into config.php and config-local.php?", true)) {
$localConfig = $this->wire()->config->paths->site . "config-local.php";
if (!is_file($localConfig) and $this->confirm("Split config into config.php and config-local.php?", true)) {
$this->warn('Adding config-local.php ...');
$dst = $this->app->rootPath() . "config-local.php";
$write = true;
if (is_file($dst)) {
if (!$this->confirm("$dst exists - overwrite it?", false)) {
$this->write("Aborting...");
$write = false;
}
}
if ($write) {
$src = $this->stub('config-local.php');
$config = $this->wire()->config;
$this->stubPopulate($src, $dst, [
'host' => $config->httpHost,
'userAuthSalt' => $config->userAuthSalt,
'tableSalt' => $config->tableSalt,
]);
$gitignore = $this->app->rootPath() . ".gitignore";
if (!is_file($gitignore)) {
file_put_contents($gitignore, "config-local.php\n");
}

$src = $this->stub('config-local.php');
$config = $this->wire()->config;
$this->stubPopulate($src, $localConfig, [
'host' => $config->httpHost,
'userAuthSalt' => $config->userAuthSalt,
'tableSalt' => $config->tableSalt,
]);
$gitignore = $this->app->rootPath() . ".gitignore";
if (!is_file($gitignore)) {
file_put_contents($gitignore, "config-local.php\n");
}

// update config.php
Expand Down
3 changes: 2 additions & 1 deletion App/stubs/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
* Load local config
* Added via rockshell pw:install command.
* This makes it possible to add config.php to your git project.
* Adjust this path if you are using a different docroot
*/
require __DIR__ . "/../../config-local.php";
require __DIR__ . "/config-local.php";

0 comments on commit 0f1c509

Please sign in to comment.