config: add ssl/tls options for mysql and redis (#3464)

This commit is contained in:
Matthew Penner 2021-07-17 11:01:23 -06:00 committed by GitHub
parent 682ca6cecd
commit 801cb8e487
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 8 deletions

View file

@ -14,6 +14,7 @@
"php": "^7.4 || ^8.0", "php": "^7.4 || ^8.0",
"ext-json": "*", "ext-json": "*",
"ext-mbstring": "*", "ext-mbstring": "*",
"ext-pdo": "*",
"ext-pdo_mysql": "*", "ext-pdo_mysql": "*",
"ext-zip": "*", "ext-zip": "*",
"aws/aws-sdk-php": "^3.171", "aws/aws-sdk-php": "^3.171",

View file

@ -10,7 +10,7 @@ return [
| using this caching library. This connection is used when another is | using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function. | not explicitly specified when executing a given caching function.
| |
| Supported: "apc", "array", "database", "file", "memcached", "redis" | Supported: "apc", "array", "database", "file", "memcached", "redis", "octane"
| |
*/ */
@ -34,12 +34,14 @@ return [
'array' => [ 'array' => [
'driver' => 'array', 'driver' => 'array',
'serialize' => false,
], ],
'database' => [ 'database' => [
'driver' => 'database', 'driver' => 'database',
'table' => 'cache', 'table' => 'cache',
'connection' => null, 'connection' => null,
'lock_connection' => null,
], ],
'file' => [ 'file' => [
@ -69,6 +71,7 @@ return [
'redis' => [ 'redis' => [
'driver' => 'redis', 'driver' => 'redis',
'connection' => 'default', 'connection' => 'default',
'lock_connection' => 'default',
], ],
'sessions' => [ 'sessions' => [
@ -76,6 +79,10 @@ return [
'table' => 'sessions', 'table' => 'sessions',
'connection' => env('SESSION_DRIVER') === 'redis' ? 'sessions' : null, 'connection' => env('SESSION_DRIVER') === 'redis' ? 'sessions' : null,
], ],
'octane' => [
'driver' => 'octane',
],
], ],
/* /*

View file

@ -1,5 +1,6 @@
<?php <?php
use Illuminate\Support\Str;
use Pterodactyl\Helpers\Time; use Pterodactyl\Helpers\Time;
return [ return [
@ -35,17 +36,26 @@ return [
'connections' => [ 'connections' => [
'mysql' => [ 'mysql' => [
'driver' => 'mysql', 'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'), 'host' => env('DB_HOST', '127.0.0.1'),
'unix_socket' => env('DB_SOCKET'),
'port' => env('DB_PORT', '3306'), 'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'panel'), 'database' => env('DB_DATABASE', 'panel'),
'username' => env('DB_USERNAME', 'pterodactyl'), 'username' => env('DB_USERNAME', 'pterodactyl'),
'password' => env('DB_PASSWORD', ''), 'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4', 'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci', 'collation' => 'utf8mb4_unicode_ci',
'prefix' => env('DB_PREFIX', ''), 'prefix' => env('DB_PREFIX', ''),
'prefix_indexes' => true,
'strict' => env('DB_STRICT_MODE', false), 'strict' => env('DB_STRICT_MODE', false),
'timezone' => env('DB_TIMEZONE', Time::getMySQLTimezoneOffset(env('APP_TIMEZONE', 'UTC'))), 'timezone' => env('DB_TIMEZONE', Time::getMySQLTimezoneOffset(env('APP_TIMEZONE', 'UTC'))),
'sslmode' => env('DB_SSLMODE', 'prefer'),
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
PDO::MYSQL_ATTR_SSL_CERT => env('MYSQL_ATTR_SSL_CERT'),
PDO::MYSQL_ATTR_SSL_KEY => env('MYSQL_ATTR_SSL_KEY'),
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => env('MYSQL_ATTR_SSL_VERIFY_SERVER_CERT', true),
]) : [],
], ],
/* /*
@ -97,24 +107,47 @@ return [
*/ */
'redis' => [ 'redis' => [
'client' => 'predis', 'client' => env('REDIS_CLIENT', 'predis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],
'default' => [ 'default' => [
'scheme' => env('REDIS_SCHEME', 'tcp'), 'scheme' => env('REDIS_SCHEME', 'tcp'),
'path' => env('REDIS_PATH', '/run/redis/redis.sock'), 'path' => env('REDIS_PATH', '/run/redis/redis.sock'),
'host' => env('REDIS_HOST', 'localhost'), 'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null), 'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', 6379), 'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_DATABASE', 0), 'database' => env('REDIS_DATABASE', 0),
'context' => extension_loaded('redis') && env('REDIS_CLIENT') === 'phpredis' ? [
'stream' => array_filter([
'verify_peer' => env('REDIS_VERIFY_PEER', true),
'verify_peer_name' => env('REDIS_VERIFY_PEER_NAME', true),
'cafile' => env('REDIS_CAFILE'),
'local_cert' => env('REDIS_LOCAL_CERT'),
'local_pk' => env('REDIS_LOCAL_PK'),
]),
] : [],
], ],
'sessions' => [ 'sessions' => [
'scheme' => env('REDIS_SCHEME', 'tcp'), 'scheme' => env('REDIS_SCHEME', 'tcp'),
'path' => env('REDIS_PATH', '/run/redis/redis.sock'), 'path' => env('REDIS_PATH', '/run/redis/redis.sock'),
'host' => env('REDIS_HOST', 'localhost'), 'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null), 'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', 6379), 'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_DATABASE_SESSIONS', 1), 'database' => env('REDIS_DATABASE_SESSIONS', 1),
'context' => extension_loaded('redis') && env('REDIS_CLIENT') === 'phpredis' ? [
'stream' => array_filter([
'verify_peer' => env('REDIS_VERIFY_PEER', true),
'verify_peer_name' => env('REDIS_VERIFY_PEER_NAME', true),
'cafile' => env('REDIS_CAFILE'),
'local_cert' => env('REDIS_LOCAL_CERT'),
'local_pk' => env('REDIS_LOCAL_PK'),
]),
] : [],
], ],
], ],
]; ];

View file

@ -10,8 +10,7 @@ return [
| requests. By default, we will use the lightweight native driver but | requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here. | you may specify any of the other wonderful drivers provided here.
| |
| Supported: "file", "cookie", "database", "apc", | Supported: "file", "cookie", "database", "apc", "memcached", "redis", "array"
| "memcached", "redis", "array"
| |
*/ */
@ -147,7 +146,7 @@ return [
| |
*/ */
'domain' => env('SESSION_DOMAIN', null), 'domain' => env('SESSION_DOMAIN'),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------