From afd0858b241a2c6ba2c0547748941c0528d03301 Mon Sep 17 00:00:00 2001 From: Pig Fang Date: Wed, 26 Feb 2020 15:09:06 +0800 Subject: [PATCH] merge upstream configs --- .env.example | 2 +- .env.testing | 4 +-- config/app.php | 32 +++++++++--------- config/broadcasting.php | 59 +++++++++++++++++++++++++++++++++ config/cache.php | 28 ++++++++++++++-- config/database.php | 72 ++++++++++++++++++++++------------------- config/filesystems.php | 12 +++---- config/hashing.php | 34 ++++++++++++++++++- config/logging.php | 38 +++++++++++++++++++--- config/queue.php | 33 ++++++++++--------- config/services.php | 33 ++++++------------- config/session.php | 47 +++++++++++++++++++++++---- config/view.php | 5 ++- 13 files changed, 285 insertions(+), 114 deletions(-) create mode 100644 config/broadcasting.php diff --git a/.env.example b/.env.example index 055ea40e..e9146694 100644 --- a/.env.example +++ b/.env.example @@ -36,7 +36,7 @@ MAIL_FROM_NAME= CACHE_DRIVER=file SESSION_DRIVER=file -QUEUE_DRIVER=sync +QUEUE_CONNECTION=sync REDIS_CLIENT=predis REDIS_HOST=127.0.0.1 diff --git a/.env.testing b/.env.testing index d390b41d..24c956dd 100644 --- a/.env.testing +++ b/.env.testing @@ -22,8 +22,8 @@ MAIL_ENCRYPTION=ssl CACHE_DRIVER=array SESSION_DRIVER=array -QUEUE_DRIVER=sync -LOG_CHANNEL=black-hole +QUEUE_CONNECTION=sync +LOG_CHANNEL=null REDIS_HOST=127.0.0.1 REDIS_PASSWORD= diff --git a/config/app.php b/config/app.php index 9b3bdbb2..8282b1e1 100644 --- a/config/app.php +++ b/config/app.php @@ -25,6 +25,8 @@ return [ 'repositories/a9ff8df7-6dc3-4ff8-bb22-4871d3a43936/Items?path=%2Fupdate_preview.json' ), + 'name' => env('APP_NAME', 'Laravel'), + /* |-------------------------------------------------------------------------- | Application Environment @@ -32,7 +34,7 @@ return [ | | This value determines the "environment" your application is currently | running in. This may determine how you prefer to configure various - | services your application utilizes. Set this in your ".env" file. + | services the application utilizes. Set this in your ".env" file. | */ @@ -116,6 +118,19 @@ return [ 'fallback_locale' => 'en', + /* + |-------------------------------------------------------------------------- + | Faker Locale + |-------------------------------------------------------------------------- + | + | This locale will be used by the Faker PHP library when generating fake + | data for your database seeds. For example, this will be used to get + | localized telephone numbers, street address information and more. + | + */ + + 'faker_locale' => 'en_US', + /* |-------------------------------------------------------------------------- | Encryption Key @@ -131,21 +146,6 @@ return [ 'cipher' => 'AES-256-CBC', - /* - |-------------------------------------------------------------------------- - | Logging Configuration - |-------------------------------------------------------------------------- - | - | Here you may configure the log settings for your application. Out of - | the box, Laravel uses the Monolog PHP logging library. This gives - | you a variety of powerful log handlers / formatters to utilize. - | - | Available Settings: "single", "daily", "syslog", "errorlog" - | - */ - - 'log' => env('APP_LOG', 'single'), - /* |-------------------------------------------------------------------------- | Autoloaded Service Providers diff --git a/config/broadcasting.php b/config/broadcasting.php new file mode 100644 index 00000000..3bba1103 --- /dev/null +++ b/config/broadcasting.php @@ -0,0 +1,59 @@ + env('BROADCAST_DRIVER', 'null'), + + /* + |-------------------------------------------------------------------------- + | Broadcast Connections + |-------------------------------------------------------------------------- + | + | Here you may define all of the broadcast connections that will be used + | to broadcast events to other systems or over websockets. Samples of + | each available type of connection are provided inside this array. + | + */ + + 'connections' => [ + + 'pusher' => [ + 'driver' => 'pusher', + 'key' => env('PUSHER_APP_KEY'), + 'secret' => env('PUSHER_APP_SECRET'), + 'app_id' => env('PUSHER_APP_ID'), + 'options' => [ + 'cluster' => env('PUSHER_APP_CLUSTER'), + 'useTLS' => true, + ], + ], + + 'redis' => [ + 'driver' => 'redis', + 'connection' => 'default', + ], + + 'log' => [ + 'driver' => 'log', + ], + + 'null' => [ + 'driver' => 'null', + ], + + ], + +]; diff --git a/config/cache.php b/config/cache.php index 3ffa840b..46751e62 100644 --- a/config/cache.php +++ b/config/cache.php @@ -1,5 +1,7 @@ env('CACHE_DRIVER', 'file'), @@ -44,11 +49,19 @@ return [ 'file' => [ 'driver' => 'file', - 'path' => storage_path('framework/cache'), + 'path' => storage_path('framework/cache/data'), ], 'memcached' => [ 'driver' => 'memcached', + 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), + 'sasl' => [ + env('MEMCACHED_USERNAME'), + env('MEMCACHED_PASSWORD'), + ], + 'options' => [ + // Memcached::OPT_CONNECT_TIMEOUT => 2000, + ], 'servers' => [ [ 'host' => env('MEMCACHED_HOST', '127.0.0.1'), @@ -60,7 +73,16 @@ return [ 'redis' => [ 'driver' => 'redis', - 'connection' => 'default', + 'connection' => 'cache', + ], + + 'dynamodb' => [ + 'driver' => 'dynamodb', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), + 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), + 'endpoint' => env('DYNAMODB_ENDPOINT'), ], ], @@ -76,6 +98,6 @@ return [ | */ - 'prefix' => 'laravel', + 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'), ]; diff --git a/config/database.php b/config/database.php index f36b4fc7..b42d9b30 100644 --- a/config/database.php +++ b/config/database.php @@ -1,20 +1,9 @@ PDO::FETCH_CLASS, - /* |-------------------------------------------------------------------------- | Default Database Connection Name @@ -48,34 +37,58 @@ return [ 'sqlite' => [ 'driver' => 'sqlite', + 'url' => env('DATABASE_URL'), 'database' => env('DB_DATABASE', database_path('database.sqlite')), - 'prefix' => env('DB_PREFIX', ''), + 'prefix' => '', + 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), ], 'mysql' => [ 'driver' => 'mysql', - 'host' => env('DB_HOST', 'localhost'), + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '3306'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', - 'prefix' => env('DB_PREFIX', ''), - 'strict' => false, + 'prefix' => '', + 'prefix_indexes' => true, + 'strict' => true, 'engine' => null, + 'options' => extension_loaded('pdo_mysql') ? array_filter([ + PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + ]) : [], ], 'pgsql' => [ 'driver' => 'pgsql', - 'host' => env('DB_HOST', 'localhost'), + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), 'port' => env('DB_PORT', '5432'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8', - 'prefix' => env('DB_PREFIX', ''), + 'prefix' => '', + 'prefix_indexes' => true, 'schema' => 'public', + 'sslmode' => 'prefer', + ], + + 'sqlsrv' => [ + 'driver' => 'sqlsrv', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', 'localhost'), + 'port' => env('DB_PORT', '1433'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => 'utf8', + 'prefix' => '', + 'prefix_indexes' => true, ], ], @@ -99,41 +112,34 @@ return [ |-------------------------------------------------------------------------- | | Redis is an open source, fast, and advanced key-value store that also - | provides a richer set of commands than a typical key-value systems + | provides a richer body of commands than a typical key-value system | such as APC or Memcached. Laravel makes it easy to dig right in. | */ 'redis' => [ - // Phpredis is recommended, - // however, most of Blessing Skin users don't use redis, - // so keep `predis` as default value. - // Otherwise, an error will be thrown if phpredis is not installed. - 'client' => env('REDIS_CLIENT', 'predis'), + 'client' => env('REDIS_CLIENT', 'phpredis'), 'options' => [ 'cluster' => env('REDIS_CLUSTER', 'redis'), - 'prefix' => env( - 'REDIS_PREFIX', - Illuminate\Support\Str::slug(env('APP_NAME', 'laravel'), '_').'_database_' - ), + 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), ], 'default' => [ 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST', '127.0.0.1'), 'password' => env('REDIS_PASSWORD', null), - 'port' => env('REDIS_PORT', 6379), - 'database' => env('REDIS_DB', 0), + 'port' => env('REDIS_PORT', '6379'), + 'database' => env('REDIS_DB', '0'), ], 'cache' => [ 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST', '127.0.0.1'), 'password' => env('REDIS_PASSWORD', null), - 'port' => env('REDIS_PORT', 6379), - 'database' => env('REDIS_CACHE_DB', 1), + 'port' => env('REDIS_PORT', '6379'), + 'database' => env('REDIS_CACHE_DB', '1'), ], ], diff --git a/config/filesystems.php b/config/filesystems.php index 9b06ac61..158a769d 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -8,14 +8,12 @@ return [ |-------------------------------------------------------------------------- | | Here you may specify the default filesystem disk that should be used - | by the framework. A "local" driver, as well as a variety of cloud - | based drivers are available for your choosing. Just store away! - | - | Supported: "local", "ftp", "s3", "rackspace" + | by the framework. The "local" disk, as well as a variety of cloud + | based disks are available to your application. Just store away! | */ - 'default' => 'local', + 'default' => env('FILESYSTEM_DRIVER', 'local'), /* |-------------------------------------------------------------------------- @@ -28,7 +26,7 @@ return [ | */ - 'cloud' => 'testing', + 'cloud' => env('FILESYSTEM_CLOUD', 's3'), /* |-------------------------------------------------------------------------- @@ -39,6 +37,8 @@ return [ | may even configure multiple disks of the same driver. Defaults have | been setup for each driver as an example of the required options. | + | Supported Drivers: "local", "ftp", "sftp", "s3" + | */ 'disks' => [ diff --git a/config/hashing.php b/config/hashing.php index f929cf0c..84257708 100644 --- a/config/hashing.php +++ b/config/hashing.php @@ -11,10 +11,42 @@ return [ | passwords for your application. By default, the bcrypt algorithm is | used; however, you remain free to modify this option if you wish. | - | Supported: "bcrypt", "argon" + | Supported: "bcrypt", "argon", "argon2id" | */ 'driver' => 'bcrypt', + /* + |-------------------------------------------------------------------------- + | Bcrypt Options + |-------------------------------------------------------------------------- + | + | Here you may specify the configuration options that should be used when + | passwords are hashed using the Bcrypt algorithm. This will allow you + | to control the amount of time it takes to hash the given password. + | + */ + + 'bcrypt' => [ + 'rounds' => env('BCRYPT_ROUNDS', 10), + ], + + /* + |-------------------------------------------------------------------------- + | Argon Options + |-------------------------------------------------------------------------- + | + | Here you may specify the configuration options that should be used when + | passwords are hashed using the Argon algorithm. These will allow you + | to control the amount of time it takes to hash the given password. + | + */ + + 'argon' => [ + 'memory' => 1024, + 'threads' => 2, + 'time' => 2, + ], + ]; diff --git a/config/logging.php b/config/logging.php index 3d4279c4..088c204e 100644 --- a/config/logging.php +++ b/config/logging.php @@ -1,5 +1,9 @@ [ 'stack' => [ 'driver' => 'stack', - 'channels' => ['daily'], + 'channels' => ['single'], 'ignore_exceptions' => false, ], @@ -46,7 +51,7 @@ return [ 'driver' => 'daily', 'path' => storage_path('logs/laravel.log'), 'level' => 'debug', - 'days' => 7, + 'days' => 14, ], 'slack' => [ @@ -57,6 +62,25 @@ return [ 'level' => 'critical', ], + 'papertrail' => [ + 'driver' => 'monolog', + 'level' => 'debug', + 'handler' => SyslogUdpHandler::class, + 'handler_with' => [ + 'host' => env('PAPERTRAIL_URL'), + 'port' => env('PAPERTRAIL_PORT'), + ], + ], + + 'stderr' => [ + 'driver' => 'monolog', + 'handler' => StreamHandler::class, + 'formatter' => env('LOG_STDERR_FORMATTER'), + 'with' => [ + 'stream' => 'php://stderr', + ], + ], + 'syslog' => [ 'driver' => 'syslog', 'level' => 'debug', @@ -67,9 +91,13 @@ return [ 'level' => 'debug', ], - 'black-hole' => [ + 'null' => [ 'driver' => 'monolog', - 'handler' => Monolog\Handler\NullHandler::class, + 'handler' => NullHandler::class, + ], + + 'emergency' => [ + 'path' => storage_path('logs/laravel.log'), ], ], diff --git a/config/queue.php b/config/queue.php index d0f732a6..3a30d6c6 100644 --- a/config/queue.php +++ b/config/queue.php @@ -4,18 +4,16 @@ return [ /* |-------------------------------------------------------------------------- - | Default Queue Driver + | Default Queue Connection Name |-------------------------------------------------------------------------- | - | The Laravel queue API supports a variety of back-ends via an unified + | Laravel's queue API supports an assortment of back-ends via a single | API, giving you convenient access to each back-end using the same - | syntax for each one. Here you may set the default queue driver. - | - | Supported: "null", "sync", "database", "beanstalkd", "sqs", "redis" + | syntax for every one. Here you may define a default connection. | */ - 'default' => env('QUEUE_DRIVER', 'sync'), + 'default' => env('QUEUE_CONNECTION', 'sync'), /* |-------------------------------------------------------------------------- @@ -26,6 +24,8 @@ return [ | is used by your application. A default configuration has been added | for each back-end shipped with Laravel. You are free to add more. | + | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" + | */ 'connections' => [ @@ -38,30 +38,32 @@ return [ 'driver' => 'database', 'table' => 'jobs', 'queue' => 'default', - 'expire' => 60, + 'retry_after' => 90, ], 'beanstalkd' => [ 'driver' => 'beanstalkd', 'host' => 'localhost', 'queue' => 'default', - 'ttr' => 60, + 'retry_after' => 90, + 'block_for' => 0, ], 'sqs' => [ 'driver' => 'sqs', - 'key' => 'your-public-key', - 'secret' => 'your-secret-key', - 'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id', - 'queue' => 'your-queue-name', - 'region' => 'us-east-1', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), + 'queue' => env('SQS_QUEUE', 'your-queue-name'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], 'redis' => [ 'driver' => 'redis', 'connection' => 'default', - 'queue' => 'default', - 'expire' => 60, + 'queue' => env('REDIS_QUEUE', 'default'), + 'retry_after' => 90, + 'block_for' => null, ], ], @@ -78,6 +80,7 @@ return [ */ 'failed' => [ + 'driver' => env('QUEUE_FAILED_DRIVER', 'database'), 'database' => env('DB_CONNECTION', 'mysql'), 'table' => 'failed_jobs', ], diff --git a/config/services.php b/config/services.php index 33cc91af..2a1d616c 100644 --- a/config/services.php +++ b/config/services.php @@ -8,41 +8,26 @@ return [ |-------------------------------------------------------------------------- | | This file is for storing the credentials for third party services such - | as Stripe, Mailgun, Mandrill, and others. This file provides a sane - | default location for this type of information, allowing packages - | to have a conventional place to find your various credentials. + | as Mailgun, Postmark, AWS and more. This file provides the de facto + | location for this type of information, allowing packages to have + | a conventional file to locate the various service credentials. | */ 'mailgun' => [ 'domain' => env('MAILGUN_DOMAIN'), 'secret' => env('MAILGUN_SECRET'), - 'guzzle' => [ - 'verify' => config('secure.certificates'), - ], + 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), ], - 'mandrill' => [ - 'secret' => env('MANDRILL_SECRET'), - 'guzzle' => [ - 'verify' => config('secure.certificates'), - ], + 'postmark' => [ + 'token' => env('POSTMARK_TOKEN'), ], 'ses' => [ - 'key' => env('SES_KEY'), - 'secret' => env('SES_SECRET'), - 'region' => env('SES_REGION'), - 'guzzle' => [ - 'verify' => config('secure.certificates'), - ], - ], - - 'sparkpost' => [ - 'secret' => env('SPARKPOST_SECRET'), - 'guzzle' => [ - 'verify' => config('secure.certificates'), - ], + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], ]; diff --git a/config/session.php b/config/session.php index c428d389..857ebc3e 100644 --- a/config/session.php +++ b/config/session.php @@ -1,5 +1,7 @@ 120, + 'lifetime' => env('SESSION_LIFETIME', 120), 'expire_on_close' => false, @@ -44,7 +46,7 @@ return [ | */ - 'encrypt' => true, + 'encrypt' => false, /* |-------------------------------------------------------------------------- @@ -70,7 +72,7 @@ return [ | */ - 'connection' => null, + 'connection' => env('SESSION_CONNECTION', null), /* |-------------------------------------------------------------------------- @@ -85,6 +87,19 @@ return [ 'table' => 'sessions', + /* + |-------------------------------------------------------------------------- + | Session Cache Store + |-------------------------------------------------------------------------- + | + | When using the "apc", "memcached", or "dynamodb" session drivers you may + | list a cache store that should be used for these sessions. This value + | must match with one of the application's configured cache "stores". + | + */ + + 'store' => env('SESSION_STORE', null), + /* |-------------------------------------------------------------------------- | Session Sweeping Lottery @@ -109,7 +124,10 @@ return [ | */ - 'cookie' => 'BS_SESSION', + 'cookie' => env( + 'SESSION_COOKIE', + Str::slug(env('APP_NAME', 'laravel'), '_').'_session' + ), /* |-------------------------------------------------------------------------- @@ -135,7 +153,7 @@ return [ | */ - 'domain' => null, + 'domain' => env('SESSION_DOMAIN', null), /* |-------------------------------------------------------------------------- @@ -148,7 +166,7 @@ return [ | */ - 'secure' => false, + 'secure' => env('SESSION_SECURE_COOKIE', false), /* |-------------------------------------------------------------------------- @@ -163,4 +181,19 @@ return [ 'http_only' => true, + /* + |-------------------------------------------------------------------------- + | Same-Site Cookies + |-------------------------------------------------------------------------- + | + | This option determines how your cookies behave when cross-site requests + | take place, and can be used to mitigate CSRF attacks. By default, we + | do not enable this as other CSRF protection services are in place. + | + | Supported: "lax", "strict", "none" + | + */ + + 'same_site' => null, + ]; diff --git a/config/view.php b/config/view.php index 17110f4d..854a66a9 100644 --- a/config/view.php +++ b/config/view.php @@ -29,6 +29,9 @@ return [ | */ - 'compiled' => realpath(storage_path('framework/views')), + 'compiled' => env( + 'VIEW_COMPILED_PATH', + realpath(storage_path('framework/views')) + ), ];