incorrect error capture for creating member secret

the init process was erroring out because instead of re-running the
script to make a valid token, it was not capturing the correct error, so
it would just fail

also the folder for saving config files needed to be created to save
them, so that addition was made as well
This commit is contained in:
ro 2024-06-02 21:33:20 -06:00
parent 2f405ffb6d
commit 728a2e5a69
No known key found for this signature in database
GPG key ID: 29B551CDBD4D3B50

View file

@ -3,7 +3,7 @@
namespace App\Services\Upkeep; namespace App\Services\Upkeep;
use ReallySimpleJWT\Token; use ReallySimpleJWT\Token;
use ReallySimpleJWT\Exception\BuildException; use ReallySimpleJWT\Exception\EncodeException;
use App\Services\Assets\DocService; use App\Services\Assets\DocService;
use Carbon\Carbon; use Carbon\Carbon;
@ -34,7 +34,7 @@ class InitService
try { try {
$secret = Token::create(12, $string, time() + 3600, 'localhost'); $secret = Token::create(12, $string, time() + 3600, 'localhost');
return $string; return $string;
} catch (BuildException $e) { } catch (EncodeException $e) {
//bad secret, so try agiain //bad secret, so try agiain
return self::validSecret(12); return self::validSecret(12);
} }
@ -103,6 +103,7 @@ class InitService
]; ];
//once all files created, write down //once all files created, write down
mkdir('../content/config', 0755, true);
$this->docs->writeSettings($newSettings, '../content/config/settings.json'); $this->docs->writeSettings($newSettings, '../content/config/settings.json');
$this->docs->writeSettings($newFolks, '../content/config/folks.json'); $this->docs->writeSettings($newFolks, '../content/config/folks.json');
$this->docs->writeSettings([], '../content/config/tags.json'); $this->docs->writeSettings([], '../content/config/tags.json');