Skip to content

Commit

Permalink
Refactor settings configuration in Bitrix
Browse files Browse the repository at this point in the history
Settings configuration in Bitrix projects has been updated. Use statements are added to optimize class references, changes are made to session, cache, http_client_options and connection values mainly to enhance performance. Also, paths in some log files are re-directed to 'upload' directory.
  • Loading branch information
hipot committed Jan 27, 2024
1 parent b2b8b45 commit 8af176f
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions .settings_extra.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
* Date: 18.11.2019 0:39
* @version pre 1.0
*/

use Bitrix\Main\Loader;
use Bitrix\Main\Data\MemcacheConnection;
use Bitrix\Main\Data\CacheEngineMemcache;
use Bitrix\Main\Web\HttpClient;
use Bitrix\Main\File\Image\Imagick as BitrixImagick;

$defaultSettings = require __DIR__ . '/.settings.php';

Expand All @@ -26,18 +31,15 @@
],
],
]
],
/*'session' => [
/*
'value' => [
'mode' => 'default',
'handlers' => [
'general' => [
'type' => 'file',
]
],
]
],*/
/*'session' => [
],
'value' => [
'mode' => 'default',
'handlers' => [
Expand All @@ -49,7 +51,8 @@
],
],
],
],*/
*/
],
'crypto' => [
'value' => [
'crypto_key' => '', //советуем устанавливать 32-х символьную строку из a-z0-9
Expand All @@ -59,7 +62,7 @@
'cache' => [
'value' => [
'type' => [
'class_name' => \Bitrix\Main\Data\CacheEngineMemcache::class,
'class_name' => CacheEngineMemcache::class,
'extension' => 'memcache'
],
'memcache' => [
Expand Down Expand Up @@ -90,22 +93,25 @@
'composer' => [
'value' => ['config_path' => 'local/composer.json'] // may relative path set
],
/* @see https://dev.1c-bitrix.ru/api_d7/bitrix/main/web/httpclient/legacy.php */
'http_client_options' => [
'value' => [
'redirect' => true,
'redirectMax' => 5,
'version' => '1.1',
'socketTimeout' => 30,
'streamTimeout' => 50,
'disableSslVerification' => true
'redirectMax' => 3,
'version' => HttpClient::HTTP_1_1,
'socketTimeout' => 20,
'streamTimeout' => 40,
'disableSslVerification' => true,
'useCurl' => true,
'curlLogFile' => Loader::getDocumentRoot() . '/upload/curl.log' // opt
],
'readonly' => false,
],
'connections' => [
'value' => [
'default' => $defaultSettings['connections']['value']['default'],
'memcache' => [
'className' => \Bitrix\Main\Data\MemcacheConnection::class,
'className' => MemcacheConnection::class,
'port' => 0,
'host' => 'unix:///home/bitrix/memcached.sock'
],
Expand All @@ -116,15 +122,15 @@
'value' => [
'enabled' => true,
'debug' => true, // opt
'log_file' => Loader::getDocumentRoot() . '/mailer.log' // opt
'log_file' => Loader::getDocumentRoot() . '/upload/mailer.log' // opt
]
],

'services' => [
'value' => [
'main.imageEngine' => [
'className' => \Bitrix\Main\File\Image\Imagick::class
],
'main.imageEngine' => array(
'className' => BitrixImagick::class
),
'Orhanerday.OpenAI' => [
'constructor' => static function () {
// see page https://platform.openai.com/account/api-keys
Expand Down

0 comments on commit 8af176f

Please sign in to comment.