diff --git a/app/Console/Commands/Environment/CacheSettingsCommand.php b/app/Console/Commands/Environment/CacheSettingsCommand.php index 4870e1bc9..97705734d 100644 --- a/app/Console/Commands/Environment/CacheSettingsCommand.php +++ b/app/Console/Commands/Environment/CacheSettingsCommand.php @@ -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, ]); } diff --git a/app/Console/Commands/Environment/QueueSettingsCommand.php b/app/Console/Commands/Environment/QueueSettingsCommand.php index 3d48a3123..6cca843ae 100644 --- a/app/Console/Commands/Environment/QueueSettingsCommand.php +++ b/app/Console/Commands/Environment/QueueSettingsCommand.php @@ -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, ]); } diff --git a/app/Console/Commands/Environment/SessionSettingsCommand.php b/app/Console/Commands/Environment/SessionSettingsCommand.php index 9a4081c51..a314d8edf 100644 --- a/app/Console/Commands/Environment/SessionSettingsCommand.php +++ b/app/Console/Commands/Environment/SessionSettingsCommand.php @@ -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, ]); } diff --git a/app/Traits/Commands/RequestRedisSettingsTrait.php b/app/Traits/Commands/RequestRedisSettingsTrait.php index 527915da6..07ef229c2 100644 --- a/app/Traits/Commands/RequestRedisSettingsTrait.php +++ b/app/Traits/Commands/RequestRedisSettingsTrait.php @@ -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'; } diff --git a/lang/en/commands.php b/lang/en/commands.php index 3b9ab9f45..b6fa6c9ca 100644 --- a/lang/en/commands.php +++ b/lang/en/commands.php @@ -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' => [