forked from pelican-dev/panel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into Webhook
- Loading branch information
Showing
21 changed files
with
773 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands\Environment; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Contracts\Console\Kernel; | ||
use App\Traits\Commands\EnvironmentWriterTrait; | ||
use App\Traits\Commands\RequestRedisSettingsTrait; | ||
|
||
class CacheSettingsCommand extends Command | ||
{ | ||
use EnvironmentWriterTrait; | ||
use RequestRedisSettingsTrait; | ||
|
||
public const CACHE_DRIVERS = [ | ||
'file' => 'Filesystem (default)', | ||
'database' => 'Database', | ||
'redis' => 'Redis', | ||
]; | ||
|
||
protected $description = 'Configure cache settings for the Panel.'; | ||
|
||
protected $signature = 'p:environment:cache | ||
{--driver= : The cache driver backend to use.} | ||
{--redis-host= : Redis host to use for connections.} | ||
{--redis-pass= : Password used to connect to redis.} | ||
{--redis-port= : Port to connect to redis over.}'; | ||
|
||
protected array $variables = []; | ||
|
||
/** | ||
* CacheSettingsCommand constructor. | ||
*/ | ||
public function __construct(private Kernel $console) | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Handle command execution. | ||
*/ | ||
public function handle(): int | ||
{ | ||
$selected = config('cache.default', 'file'); | ||
$this->variables['CACHE_STORE'] = $this->option('driver') ?? $this->choice( | ||
'Cache Driver', | ||
self::CACHE_DRIVERS, | ||
array_key_exists($selected, self::CACHE_DRIVERS) ? $selected : null | ||
); | ||
|
||
if ($this->variables['CACHE_STORE'] === 'redis') { | ||
$this->requestRedisSettings(); | ||
|
||
if (config('queue.default') !== 'sync') { | ||
$this->call('p:environment:queue-service', [ | ||
'--use-redis' => true, | ||
'--overwrite' => true, | ||
]); | ||
} | ||
} | ||
|
||
$this->writeToEnvironment($this->variables); | ||
|
||
$this->info($this->console->output()); | ||
|
||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands\Environment; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Contracts\Console\Kernel; | ||
use App\Traits\Commands\EnvironmentWriterTrait; | ||
use App\Traits\Commands\RequestRedisSettingsTrait; | ||
|
||
class QueueSettingsCommand extends Command | ||
{ | ||
use EnvironmentWriterTrait; | ||
use RequestRedisSettingsTrait; | ||
|
||
public const QUEUE_DRIVERS = [ | ||
'database' => 'Database (default)', | ||
'redis' => 'Redis', | ||
'sync' => 'Synchronous', | ||
]; | ||
|
||
protected $description = 'Configure queue settings for the Panel.'; | ||
|
||
protected $signature = 'p:environment:queue | ||
{--driver= : The queue driver backend to use.} | ||
{--redis-host= : Redis host to use for connections.} | ||
{--redis-pass= : Password used to connect to redis.} | ||
{--redis-port= : Port to connect to redis over.}'; | ||
|
||
protected array $variables = []; | ||
|
||
/** | ||
* QueueSettingsCommand constructor. | ||
*/ | ||
public function __construct(private Kernel $console) | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Handle command execution. | ||
*/ | ||
public function handle(): int | ||
{ | ||
$selected = config('queue.default', 'database'); | ||
$this->variables['QUEUE_CONNECTION'] = $this->option('driver') ?? $this->choice( | ||
'Queue Driver', | ||
self::QUEUE_DRIVERS, | ||
array_key_exists($selected, self::QUEUE_DRIVERS) ? $selected : null | ||
); | ||
|
||
if ($this->variables['QUEUE_CONNECTION'] === 'redis') { | ||
$this->requestRedisSettings(); | ||
|
||
$this->call('p:environment:queue-service', [ | ||
'--use-redis' => true, | ||
'--overwrite' => true, | ||
]); | ||
} | ||
|
||
$this->writeToEnvironment($this->variables); | ||
|
||
$this->info($this->console->output()); | ||
|
||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.