Skip to content

Commit

Permalink
feat: add random salts to config-local suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardBaumrock committed May 23, 2023
1 parent 28b5657 commit 1e7401c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions classes/Deployment.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use ProcessWire\Paths;
use ProcessWire\ProcessWire;
use ProcessWire\WireData;
use ProcessWire\WireRandom;

chdir(__DIR__);
chdir("../../../../");
Expand Down Expand Up @@ -498,10 +499,18 @@ public function share($files = null, $reset = false)
if (basename($toAbs) == 'config-local.php') {
$configDir = dirname($toAbs);
$this->exec("mkdir -p $configDir");
$rand = new WireRandom();
$opt = ['minLength' => 30, 'maxLength' => 60];
$rand1 = $rand->alphanumeric(0, $opt);
$rand2 = $rand->alphanumeric(0, $opt);
file_put_contents(
$toAbs,
"<?php\n// file created by RockMigrations"
. "\n// put your site-specific config here\n"
. "\n// you can use these random salts:\n"
. "\n// \$config->userAuthSalt = '$rand1';\n"
. "\n// \$config->tableSalt = '$rand2';\n"
. "\n// you can use these random salts:\n"
);
}
}
Expand Down

0 comments on commit 1e7401c

Please sign in to comment.