mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-19 19:54:45 +02:00
Patch Env CLI (#528)
* Remove unused option * Add redis user * Adapt lang * Change default redis username * Cleanup * Update app/Traits/Commands/RequestRedisSettingsTrait.php Co-authored-by: Boy132 <Boy132@users.noreply.github.com> --------- Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
This commit is contained in:
parent
d6e0421aaf
commit
7f8fb3f650
@ -23,6 +23,7 @@ class CacheSettingsCommand extends Command
|
||||
protected $signature = 'p:environment:cache
|
||||
{--driver= : The cache driver backend to use.}
|
||||
{--redis-host= : Redis host to use for connections.}
|
||||
{--redis-user= : User used to connect to redis.}
|
||||
{--redis-pass= : Password used to connect to redis.}
|
||||
{--redis-port= : Port to connect to redis over.}';
|
||||
|
||||
@ -53,7 +54,6 @@ class CacheSettingsCommand extends Command
|
||||
|
||||
if (config('queue.default') !== 'sync') {
|
||||
$this->call('p:environment:queue-service', [
|
||||
'--use-redis' => true,
|
||||
'--overwrite' => true,
|
||||
]);
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ class QueueSettingsCommand extends Command
|
||||
protected $signature = 'p:environment:queue
|
||||
{--driver= : The queue driver backend to use.}
|
||||
{--redis-host= : Redis host to use for connections.}
|
||||
{--redis-user= : User used to connect to redis.}
|
||||
{--redis-pass= : Password used to connect to redis.}
|
||||
{--redis-port= : Port to connect to redis over.}';
|
||||
|
||||
@ -52,7 +53,6 @@ class QueueSettingsCommand extends Command
|
||||
$this->requestRedisSettings();
|
||||
|
||||
$this->call('p:environment:queue-service', [
|
||||
'--use-redis' => true,
|
||||
'--overwrite' => true,
|
||||
]);
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ class SessionSettingsCommand extends Command
|
||||
protected $signature = 'p:environment:session
|
||||
{--driver= : The session driver backend to use.}
|
||||
{--redis-host= : Redis host to use for connections.}
|
||||
{--redis-user= : User used to connect to redis.}
|
||||
{--redis-pass= : Password used to connect to redis.}
|
||||
{--redis-port= : Port to connect to redis over.}';
|
||||
|
||||
@ -54,7 +55,6 @@ class SessionSettingsCommand extends Command
|
||||
|
||||
if (config('queue.default') !== 'sync') {
|
||||
$this->call('p:environment:queue-service', [
|
||||
'--use-redis' => true,
|
||||
'--overwrite' => true,
|
||||
]);
|
||||
}
|
||||
|
@ -12,12 +12,24 @@ trait RequestRedisSettingsTrait
|
||||
config('database.redis.default.host')
|
||||
);
|
||||
|
||||
$askForRedisUser = true;
|
||||
$askForRedisPassword = true;
|
||||
|
||||
if (!empty(config('database.redis.default.user'))) {
|
||||
$this->variables['REDIS_USERNAME'] = config('database.redis.default.user');
|
||||
$askForRedisUser = $this->confirm(__('commands.appsettings.redis.confirm', ['field' => 'user']));
|
||||
}
|
||||
if (!empty(config('database.redis.default.password'))) {
|
||||
$this->variables['REDIS_PASSWORD'] = config('database.redis.default.password');
|
||||
$askForRedisPassword = $this->confirm('It seems a password is already defined for Redis, would you like to change it?');
|
||||
$askForRedisPassword = $this->confirm(__('commands.appsettings.redis.confirm', ['field' => 'password']));
|
||||
}
|
||||
|
||||
if ($askForRedisUser) {
|
||||
$this->output->comment(__('commands.appsettings.redis.comment'));
|
||||
$this->variables['REDIS_USERNAME'] = $this->option('redis-user') ?? $this->output->askHidden(
|
||||
'Redis User'
|
||||
);
|
||||
}
|
||||
if ($askForRedisPassword) {
|
||||
$this->output->comment(__('commands.appsettings.redis.comment'));
|
||||
$this->variables['REDIS_PASSWORD'] = $this->option('redis-pass') ?? $this->output->askHidden(
|
||||
@ -25,6 +37,9 @@ trait RequestRedisSettingsTrait
|
||||
);
|
||||
}
|
||||
|
||||
if (empty($this->variables['REDIS_USERNAME'])) {
|
||||
$this->variables['REDIS_USERNAME'] = 'null';
|
||||
}
|
||||
if (empty($this->variables['REDIS_PASSWORD'])) {
|
||||
$this->variables['REDIS_PASSWORD'] = 'null';
|
||||
}
|
||||
|
@ -9,7 +9,8 @@ return [
|
||||
],
|
||||
'redis' => [
|
||||
'note' => 'You\'ve selected the Redis driver for one or more options, please provide valid connection information below. In most cases you can use the defaults provided unless you have modified your setup.',
|
||||
'comment' => 'By default a Redis server instance has no password as it is running locally and inaccessible to the outside world. If this is the case, simply hit enter without entering a value.',
|
||||
'comment' => 'By default a Redis server instance has for username default and no password as it is running locally and inaccessible to the outside world. If this is the case, simply hit enter without entering a value.',
|
||||
'confirm' => 'It seems a :field is already defined for Redis, would you like to change it?',
|
||||
],
|
||||
],
|
||||
'database_settings' => [
|
||||
|
Loading…
x
Reference in New Issue
Block a user