-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.settings_extra.php
216 lines (205 loc) · 5.6 KB
/
.settings_extra.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<?php
/**
* hipot studio source file
* User: <hipot AT ya DOT ru>
* Date: 18.11.2019 0:39
* @version pre 1.0
*/
use Bitrix\Main\Data\CacheEngineApc;
use Bitrix\Main\Data\CacheEngineFiles;
use Bitrix\Main\Data\CacheEngineMemcache;
use Bitrix\Main\Data\MemcacheConnection;
use Bitrix\Main\DB\ConnectionException;
use Bitrix\Main\Loader;
use Bitrix\Main\Web\HttpClient;
use Bitrix\Main\File\Image\Imagick as BitrixImagick;
$defaultSettings = require __DIR__ . '/.settings.php';
$sid = Loader::getDocumentRoot() . "#01";
return [
/* @see https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=43&LESSON_ID=2795#cache */
'cache' => [
'value' => [
'type' => [
'class_name' => CacheEngineFiles::class,
],
'sid' => $sid
],
/*
'value' => [
'type' => [
'class_name' => CacheEngineMemcache::class,
'extension' => 'memcache'
],
'memcache' => [
'host' => '127.0.0.1', // 'unix:///home/bitrix/memcached.sock'
'port' => '11211', // '0'
],
'sid' => $sid
]
*/
],
'cache_flags' => [
'value' => [
'config_options' => 3600,
'site_domain' => 3600 * 24 * 7,
'geoip_manager' => 604800 * 2, // a two week
// Кеш пишется в папку /bitrix/managed_cache/MYSQL/orm_%имя_таблицы_сущности_orm%/ с ключом md5(%sql-запрос%)
"b_hlblock_entity_min_ttl" => 60,
"b_hlblock_entity_max_ttl" => 86400,
"b_iblock_element_min_ttl" => 60,
"b_iblock_element_max_ttl" => 86400,
"b_iblock_property_min_ttl" => 68400,
"b_iblock_property_max_ttl" => 68400,
"b_iblock_min_ttl" => 68400,
"b_iblock_max_ttl" => 68400,
"b_group_min_ttl" => 86400,
"b_group_max_ttl" => 86400,
"b_lang_min_ttl" => 86400,
"b_lang_max_ttl" => 86400,
],
'readonly' => false,
],
'crypto' => [
'value' => [
'crypto_key' => '', //советуем устанавливать 32-х символьную строку из a-z0-9
],
'readonly' => true
],
// two stages sessions
'session' => [
'value' => [
'lifetime' => 14400,
'mode' => 'separated',
'handlers' => [
'kernel' => 'encrypted_cookies',
'general' => [
'type' => 'file',
/*'type' => 'memcache',
'port' => '0',
'host' => 'unix:///home/bitrix/memcached.sock'*/
],
],
]
/*
'value' => [
'mode' => 'default',
'handlers' => [
'general' => [
'type' => 'file',
]
],
],
'value' => [
'mode' => 'default',
'handlers' => [
'general' => [
'type' => 'redis',
'port' => '6379',
'host' => '127.0.0.1',
'serializer' => \Redis::SERIALIZER_PHP
],
],
],
*/
],
'connections' => [
'value' => [
'default' => $defaultSettings['connections']['value']['default'],
'memcache' => [
'className' => MemcacheConnection::class,
'port' => 0,
'host' => 'unix:///home/bitrix/memcached.sock',
'sid' => $sid
]
]
],
'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' => 3,
'version' => HttpClient::HTTP_1_1,
'socketTimeout' => 20,
'streamTimeout' => 40,
'disableSslVerification' => true,
'useCurl' => true,
'curlLogFile' => Loader::getDocumentRoot() . '/upload/curl.log' // opt
],
'readonly' => false,
],
'smtp' => [
'value' => [
'enabled' => true,
'debug' => true, // opt
'log_file' => Loader::getDocumentRoot() . '/upload/mailer.log' // opt
]
],
/* @see https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=105&LESSON_ID=14032&LESSON_PATH=9209.5062.14032 */
'services' => [
'value' => [
'main.imageEngine' => [
'className' => BitrixImagick::class
],
'Orhanerday.OpenAI' => [
'constructor' => static function () {
// see page https://platform.openai.com/account/api-keys
$open_ai_key = getenv('OPENAI_API_KEY');
return new \Orhanerday\OpenAi\OpenAi($open_ai_key);
},
],
'cache.files' => [
'constructor' => static function () {
$options = [];
return new CacheEngineFiles($options);
}
],
'cache.apc' => [
'constructor' => static function () {
// important: set 'sid' in 'cache-value' section of config
$options = [
'type' => 'apcu',
'use_lock' => true
];
return new class ($options) extends CacheEngineApc {
/** @noinspection MagicMethodsValidityInspection */
public function __construct(array $options = [])
{
$config = $this->configure($options);
$this->connect($config);
}
};
}
],
'cache.memcache' => [
'constructor' => static function () {
// important: set 'sid' in 'cache-value' section of config
$options = [
'type' => 'memcache',
'servers' => [
[
'host' => 'unix:///home/bitrix/memcached.sock',
'port' => 0
]
],
'use_lock' => true
];
return new class ($options) extends CacheEngineMemcache {
/** @noinspection MagicMethodsValidityInspection */
public function __construct(array $options = [])
{
$config = $this->configure($options);
$this->connect($config);
if (self::$isConnected === false) {
throw new ConnectionException('Cant connect to memcache');
}
}
};
}
],
],
'readonly' => true
]
];