TelegramApiServer/config.php

69 lines
2.6 KiB
PHP
Raw Normal View History

<?php
2020-01-19 04:17:14 +01:00
$settings = [
2019-06-20 18:51:58 +02:00
'server' => [
'address' => (string)getenv('SERVER_ADDRESS'),
'port' => (string)getenv('SERVER_PORT'),
],
'telegram' => [
'app_info' => [ // obtained in https://my.telegram.org
2019-03-19 00:36:20 +01:00
'api_id' => getenv('TELEGRAM_API_ID'),
'api_hash' => getenv('TELEGRAM_API_HASH'),
],
'logger' => [ // Logger settings
2020-02-10 02:50:17 +01:00
'logger' => \danog\MadelineProto\Logger::CALLABLE_LOGGER, // 0 - Logs disabled, 3 - echo logs.
'logger_param' => \TelegramApiServer\EventObservers\LogObserver::class . '::log',
2019-12-08 13:46:54 +01:00
'logger_level' => getenv('LOGGER_LEVEL'), // Logging level, available logging levels are: ULTRA_VERBOSE - 5, VERBOSE - 4 , NOTICE - 3, WARNING - 2, ERROR - 1, FATAL_ERROR - 0.
],
'updates' => [
'handle_updates' => true, // Should I handle updates?
'handle_old_updates' => false, // Should I handle old updates on startup?
],
'connection_settings' => [
'all' => [
'proxy' => '\SocksProxy',
2019-03-19 00:36:20 +01:00
'proxy_extra' => [
'address' => getenv('TELEGRAM_PROXY_ADDRESS'),
'port' => getenv('TELEGRAM_PROXY_PORT'),
'username' => getenv('TELEGRAM_PROXY_USERNAME'),
'password' => getenv('TELEGRAM_PROXY_PASSWORD'),
]
]
2019-04-19 14:49:01 +02:00
],
'serialization' => [
2019-06-22 19:16:31 +02:00
'serialization_interval' => 300,
'cleanup_before_serialization' => true,
],
2020-04-26 20:50:42 +02:00
'db' => [
'type' => getenv('DB_TYPE'),
'mysql' => [
'host' => getenv('MYSQL_HOST'),
'port' => (int) getenv('MYSQL_PORT'),
'user' => getenv('MYSQL_USER'),
'password' => getenv('MYSQL_PASSWORD'),
2020-05-04 22:18:54 +02:00
'database' => getenv('MYSQL_DATABASE'),
'max_connections' => (int) getenv('MYSQL_MAX_CONNECTIONS'),
'idle_timeout' => (int) getenv('MYSQL_IDLE_TIMEOUT'),
2020-05-17 22:19:21 +02:00
'cache_ttl' => getenv('MYSQL_CACHE_TTL'),
2020-04-26 20:50:42 +02:00
]
],
2019-12-08 13:46:54 +01:00
'download'=>[
'report_broken_media' => false,
]
],
2019-01-20 18:20:41 +01:00
'api' => [
2019-03-19 23:56:28 +01:00
'ip_whitelist' => array_filter(
array_map(
'trim',
explode(',', getenv('IP_WHITELIST'))
)
),
2019-01-20 18:20:41 +01:00
],
2020-01-19 04:17:14 +01:00
];
2020-01-20 20:53:17 +01:00
if (empty($settings['telegram']['connection_settings']['all']['proxy_extra']['address'])) {
$settings['telegram']['connection_settings']['all']['proxy'] = '\Socket';
$settings['telegram']['connection_settings']['all']['proxy_extra'] = [];
2020-01-19 04:17:14 +01:00
}
return $settings;