pelican-panel-mirror/app/Traits/Commands/RequestRedisSettingsTrait.php
MartinOscar 1f6b659546
Fix Translations (#994)
* Fix copy paste AllocationsRelationManager

* We shouldn't let the user know if the user is correct but the password isn't

* Add missing `trans()` `EditServer`

* Add missing `trans()` User `ServersRelationManager`

* Replace every `__()` with `trans()` helper

* Fix `exceptions` `User` Model

* Replace `Translator->get()` with `trans()` helper

* Revert "We shouldn't let the user know if the user is correct but the password isn't"

This reverts commit e156ee4b38e9e969662a532648c78fdc1e9b0166.
that's stock laravel, therefore it needs to stay
2025-02-11 22:16:48 +01:00

53 lines
1.9 KiB
PHP

<?php
namespace App\Traits\Commands;
trait RequestRedisSettingsTrait
{
protected function requestRedisSettings(): void
{
$this->output->note(trans('commands.appsettings.redis.note'));
$this->variables['REDIS_HOST'] = $this->option('redis-host') ?? $this->ask(
'Redis Host',
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(trans('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(trans('commands.appsettings.redis.confirm', ['field' => 'password']));
}
if ($askForRedisUser) {
$this->output->comment(trans('commands.appsettings.redis.comment'));
$this->variables['REDIS_USERNAME'] = $this->option('redis-user') ?? $this->output->askHidden(
'Redis User'
);
}
if ($askForRedisPassword) {
$this->output->comment(trans('commands.appsettings.redis.comment'));
$this->variables['REDIS_PASSWORD'] = $this->option('redis-pass') ?? $this->output->askHidden(
'Redis Password'
);
}
if (empty($this->variables['REDIS_USERNAME'])) {
$this->variables['REDIS_USERNAME'] = 'null';
}
if (empty($this->variables['REDIS_PASSWORD'])) {
$this->variables['REDIS_PASSWORD'] = 'null';
}
$this->variables['REDIS_PORT'] = $this->option('redis-port') ?? $this->ask(
'Redis Port',
config('database.redis.default.port')
);
}
}